简体   繁体   English

FlowType.JS无法正常工作

[英]FlowType.JS not working

I'm attempting to use FlowType.JS on this site . 我正在尝试在此站点上使用FlowType.JS

I have the following in the head: 我头上有以下内容:

<script type='text/javascript' src='http://www.bibandtucker.net.au/test/wp-includes/js/jquery/jquery.js?ver=1.11.0'></script>
<script type="text/javascript" src="http://www.bibandtucker.net.au/test/wp-content/themes/blueduck3/js/flowtype.js"></script>
<script type="text/javascript">
  $('body').flowtype({
    minimum   : 500,
    maximum   : 1200,
    minFont   : 12,
    maxFont   : 40,
    fontRatio : 30
  });
</script>   

However, the #content P, H1, and the #menu A, p.bookings, div.opening-hours do not scale downward when I make the viewport smaller. 但是,当我缩小视口时,#content P,H1和#menu A,p.bookings,div.opens-hours不会向下缩放。

Does anyone have an idea why? 有谁知道为什么? Thanks. 谢谢。

Please enter this code, and make sure flowtype.js is called before the code. 请输入此代码,并确保在代码之前调用flowtype.js。

    <script type="text/javascript"> 
        $j = jQuery.noConflict();
        $j(document).ready(function() {
            /*$j('body').flowtype({
                minimum   : 500,
                maximum   : 1200,
                minFont   : 12,
                maxFont   : 20
              });
              */
            $j("body").flowtype({
                minFont: 16,
                maxFont: 40,
                fontRatio: 65
            });
            $j("#heading").flowtype({
                fontRatio: 36
            });
            $j("#content p").flowtype({
                minFont: 12,
                maxFont : 22,
                fontRatio: 20
            });
            $j("#menu a").flowtype({
                minFont: 16,
                fontRatio: 5                    
            });
            $j("p.bookings").flowtype({
                minFont: 11,
                fontRatio: 30
            });
            $j("div.opening-hours").flowtype({
                minFont: 18,
                fontRatio: 30
            });
        });
    </script>

Also, please note the following lines mentioned on the plugin website. 另外,请注意插件网站上提到的以下几行。

Line-height
 In v1.0 of FlowType, we made the plugin set a specific line-height in pixels. We received many statements that setting a specific line-height is very dangerous. So, what did we do? We removed support for line-height in v1.1. What do I do now? It's quite simple: use unitless line-height in your CSS. It will make automatically make changes based on whatever the font-size. Here's an example of what we suggest for line-height: fontRatio : 30; 

If you have further issue, then please mention the link to your jsfiddle code. 如果您还有其他问题,请提及jsfiddle代码的链接。

It is because you are including 2 jquery versions jquery-2.1 and jquery 1.6.4 and ther is confliction in both versions. 这是因为您包括2个jquery版本jquery-2.1jquery 1.6.4并且这两个版本中都有冲突。 You can see it in console. 您可以在控制台中看到它。

Use jquery.noConflict() for no confliction 使用jquery.noConflict()避免冲突

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM