$(window).load(function() {
var pageWidth = $(window).width();
if ( pageWidth < 800 ) {
$(".navbar.navbar-inverse").sticky({
topSpacing: 0
});
}
});
下面的代码是针对屏幕宽度超过800px的标题扩展并保持在顶部。脚本本身很好,但在移动版本中,上面的部分菜单是不必要的,所以我想根据屏幕大小禁用它,类似于如何通过媒体查询更改和禁用css。我想根据屏幕大小禁用此代码的执行: