我正在开发一个项目,并且无法增加或减少网站的字体大小。我使用的是wordpress,Genesis框架,但无法通过javascript增加/减小字体大小。如何从外部css增加/减小字体大小
请亲切地帮我解决这个问题。
我使用下面的代码;
genesis_after Hook 该钩子在结束标记之前立即执行。
<script type="text/javascript" language="javascript">
$(document).ready(function(){
// Reset Font Size
var originalFontSize = $('html').css('font-size');
$(".resetFont").click(function(){
$('html').css('font-size', originalFontSize);
});
// Increase Font Size
$(".increaseFont").click(function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*1.2;
$('html').css('font-size', newFontSize);
return false;
});
// Decrease Font Size
$(".decreaseFont").click(function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*0.8;
$('html').css('font-size', newFontSize);
return false;
});
});
</script>
genesis_before_content钩 该钩子立即执行内容列之前(在#内容的div之外)。
<a href="#" class="increaseFont">Increase</a>
<a href="#" class="decreaseFont">Decrease</a>
<a href="#" class="resetFont">Reset</a>
我的项目链接
http://174.121.86.229/~rghlifts/
请帮我解决这个问题
谢谢大家
您正在使用的mootools和jQuery在一起......如果你正在做的... MooTools是将使用“$”操作...你需要添加jQuery.noConflict()和更改所有“$”到jQuery,以便mootools可以自由使用“$”,因为它不是命名空间(ala Prototype) –
@El Guapo请你能告诉我...我不那么擅长jquery或mootools – Muzammil
请参阅@GrzegorzGąsak评论他的回答...他已经完成了 –