sách gpt4 ai đã đi

NiceScroll hiện/ẩn

In lại 作者:行者123 更新时间:2023-12-03 23:05:37 30 4
mua khóa gpt4 Nike

我想根据 nếu như 函数的结果隐藏/显示 NiceScroll.

在我的html中有三个部分,从左到右逐一滚动。

我的脚本如下:

var section2 = $('#section2').offset().left; 
$(window).scroll(function(){
var scrollZpos = $(document).scrollLeft();
if (scrollZpos <= section2 ) {
$("body").getNiceScroll().hide();
}
if (scrollZpos == section2 ) {
$("body").niceScroll({touchbehavior:false,cursorcolor:"#67a5df",horizrailenabled:false,cursoropacitymax:1,autohidemode:false,cursorwidth:10,cursorborder:0,cursorborderradius:0,cursorminheight:180});
}
else if(scrollZpos >= section2 ){
$("body").getNiceScroll().hide();
}
});

当滚动到第 2 部分之外时它会隐藏,但当向后滚动时它不会重新出现。

1 Câu trả lời

我在 Github 上找到了这个答案的解决方案。

最好在 tài liệu ready 事件期间创建 NiceScroll.

$("body").getNiceScroll().show()

关于jquery - NiceScroll显示/隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16344196/

30 4 0
Bài viết được đề xuất: javascript - JQuery 验证 - 替代方案
Bài viết được đề xuất: php - curl 不适用于我的连接的 linkedin 配置文件
Bài viết được đề xuất: Objective-C菜鸟 : How to define + call a method in main?
Bài viết được đề xuất: jquery:多次绑定(bind)事件后会发生什么?
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com