我试图在FlowType.JS上使用this site。
我头上有以下内容:
<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>
但是,当我缩小视口时,#content P,H1和#menu A,p.bookings,div.opens-hours不会向下缩放。
有谁知道为什么?谢谢。
最佳答案
请输入此代码,并确保在代码之前调用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>
另外,请注意插件网站上提到的以下几行。
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;
如果您还有其他问题,请提及jsfiddle代码的链接。