gpt4 book ai didi

javascript - 字体调整最大尺寸

转载 作者:行者123 更新时间:2023-11-29 17:22:10 25 4
gpt4 key购买 nike

我的网站有一个字体调整器。我需要为调整大小设置最大尺寸。

resizer 工作但不确定为什么我的最大值不起作用?

// Reset Font Size
var targetContainers = $('.one-third, .two-thirds');
var originalFontSize = $(targetContainers).css('font-size');

// Increase Font Size
$(".resize-larger").click(function() {
var currentFontSize = $(targetContainers).css('font-size');
var maxSize = $('18');

if (currentFontSize < maxSize) {

var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum * 1.2;
$(targetContainers).css('font-size', newFontSize);
return false;

}

});​

最佳答案

因为 $('18'); 不是数字。不要过度使用 jQuery:

var maxSize = 18;

关于javascript - 字体调整最大尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11838741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com