我正在为我的网站使用SlimScroll插件。重置窗口大小调整功能
我想重置/重新启动窗口大小的slimscroll函数,因为高度和宽度应根据#content_wrapper
div的高度和宽度进行更改。
我试过了几种方法,但似乎没有什么关系。在我目前的代码下面。有谁知道我能做到这一点?
$('#content_wrapper').slimScroll({
width: $('#content_wrapper').css({'width':(($(window).width())-240)+'px'}),
height: $('#content_wrapper').css({'height':(($(window).height())-65)+'px'})
});
// scrollbar onresize resetten
$(window).resize(function(){
$('#content_wrapper').slimScroll({
width: $('#content_wrapper').css({'width':(($(window).width())-240)+'px'}),
height: $('#content_wrapper').css({'height':(($(window).height())-65)+'px'})
});
});
你为什么要从window.width减去240和65? – Purag
因为65px是页脚的高度,而240px是菜单的宽度。 –
我明白了。为了让它看起来更好,可以尝试在变量中添加新的宽度/高度,并在slimScroll函数中设置变量。 (我也注意到你有$(window)> height()' - 你不需要)括号。 – Purag