我在我的网站上使用SlimScroll插件.
我想在窗口调整大小时重置/重新启动slimscroll函数,因为高度和宽度应根据#content_wrapperdiv 的高度和宽度进行更改.
我通过几种方式尝试过,但似乎没有什么可以做到的.在我当前的代码下面.有谁知道我怎么能做到这一点?
$('#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'})
});
});
Run Code Online (Sandbox Code Playgroud) 当有人徘徊div时,我正在使用以下脚本播放声音.
$(document).ready(function(){
var birdaudio = birdhover.find('audio')[0];
$('.sound').mouseenter(function(){ birdaudio.play(); });
$('.sound').mouseleave(function(){ birdaudio.stop(); });
});
Run Code Online (Sandbox Code Playgroud)
它确实有效,但音频一直播放到声音结束,即使不再徘徊.有什么我可以做的,以防止这种情况?我不希望每当你'鼠标'的时候音频都会停止.
希望得到帮助!