gpt4 book ai didi

jquery - 功能工作窗口调整大小

转载 作者:行者123 更新时间:2023-12-01 08:16:08 25 4
gpt4 key购买 nike

这是我的代码

var bodyWidth = ($(document).width()/2);
console.log(bodyWidth);
$('.freeshipping').css('right',bodyWidth);

它很好,但我想要这个功能主体调整大小和页面刷新。怎么办?

最佳答案

$(window).resize(function(){
var bodyWidth = ($(document).width()/2);
console.log(bodyWidth);
$('.freeshipping').css('right',bodyWidth);
});

更新:调用函数一次:

$(window).resize((function(){
var bodyWidth = ($(document).width()/2);
console.log(bodyWidth);
$('.freeshipping').css('right',bodyWidth);

return arguments.callee;
})());​

关于jquery - 功能工作窗口调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10634817/

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