jQuery调整大小事件没有触发 [英] jQuery resize event not firing
本文介绍了jQuery调整大小事件没有触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
无论出于何种原因,以下内容:
For whatever reason the following:
$(function() {
$(window).resize(function() {
alert("resized!");
});
});
仅在加载页面时触发事件。调整浏览器窗口的大小在Safari和Firefox中都不起作用。我没有在任何其他浏览器上尝试过。
only fires an event when the page is loaded. Resizing the browser window does nothing in both Safari and Firefox. I have not tried it on any other browsers.
任何想法或解决方法?
推荐答案
我认为您的提醒导致问题请尝试此操作
I think your alert is causing a problem try this instead
$(window).resize(function() {
$('body').prepend('<div>' + $(window).width() + '</div>');
});
这篇关于jQuery调整大小事件没有触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文