我有下面的jQuery函数,它意味着在窗口加载时删除一个类,如果宽度大于992 px则调整大小,如果小于992px则添加一个类。
似乎工作正常,但是如果我将窗口大小从992增加到1010px,则类会保持添加。在1011px它被移除。
sql = ('SELECT exampleschema.foo FROM bar;')
答案 0 :(得分:1)
var windowHeight = 460;
var windowWidth = 800;
if (document.body && document.body.offsetWidth) {
windowHeight = document.body.offsetHeight;
windowWidth = document.body.offsetWidth;
}
if (document.compatMode == 'CSS1Compat' && document.documentElement && document.documentElement.offsetWidth) {
windowHeight = document.documentElement.offsetHeight;
windowWidth = document.documentElement.offsetWidth;
}
if (window.innerWidth && window.innerHeight) {
windowHeight = window.innerHeight;
windowWidth = window.innerWidth;
}
if(windowWidth > 992) {
$('.bid-overlay-booking').removeClass('fancyboxID-booking');
}
else{
$('.bid-overlay-booking').addClass('fancyboxID-booking');
}