我有一个浏览器调整脚本:
$(document).ready(function() {
$(window).on('resize', function() {
if ($(this).height() <= 800) {
$('.content').css('max-height', '500px'); //set max height
}
else {
$('.content').css('max-height', ''); //delete attribute
}
}).resize()
})
我想让 jscrollpane 在窗口调整大小后运行,因为那时我需要滚动条。在我目前的代码中,它只显示常规滚动条。
$(function() {
$('.scroll-pane').jScrollPane();
});
有没有办法在最大高度脚本完成后运行这个脚本?
最佳答案
<script type="text/javascript">
$(document).ready(function() {
$(window).on('resize', function(){
if ($(this).height() <= 800){
$('.content').css('max-height', '500px'); //set max height
} else{
$('.content').css('max-height', ''); //delete attribute
}
$('.scroll-pane').jScrollPane(); //why not call it here?
}).resize()
})
</script>
关于javascript - 如何一个接一个地运行一个脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11996183/