gpt4 book ai didi

javascript - 如何一个接一个地运行一个脚本?

转载 作者:太空宇宙 更新时间:2023-11-03 21:58:43 24 4
gpt4 key购买 nike

我有一个浏览器调整脚本:

$(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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com