[Javascript] How to enlarge and small the font

html code:

代码
<a href="####" id="zoom_minify">Zoom In</a>
<a href="####" id="zoom_magnify">Zoom Out</a>

js code:

代码
<script type="text/javascript">
$(
'#zoom_minify').click(function(){
textZoom(
-1);
});
$(
'#zoom_magnify').click(function(){
textZoom(
1);
});
function textZoom(i){
var newSize = Number($('body').css('font-size').substring(0, $('body').css('font-size').length-2)) + i;
$(
'body').css('font-size', newSize);
}
</script>

原文地址:https://www.cnblogs.com/davidhhuan/p/1801731.html