gpt4 book ai didi

Jquery 面板 + 从顶部检测滚动?

转载 作者:太空宇宙 更新时间:2023-11-03 17:30:07 25 4
gpt4 key购买 nike

我目前正在测试这种类型的面板 jquery: http://codyhouse.co/gem/css-slide-in-panel/

但是当我想检测从顶部滚动以显示一个 div 时:没办法:(

一种检测面板内从顶部滚动的方法?我用这种东西没有结果http://jsfiddle.net/apaul34208/ZyKar/3/

$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 500) {
$('.cache').fadeIn();
} else {
$('.cache').fadeOut();
}

});

最好的问候,

最佳答案

这是您要找的吗?

http://jsfiddle.net/ZyKar/2327/

HTML

<div class="topMenu"></div>

CSS

body {
height:1600px;
}
.topMenu {
display: none;
position: fixed;
top: 0;
width: 100%;
height: 60px;
border-bottom: 1px solid #000;
background: red;
z-index: 1;
}

Javascript

$(document).scroll(function () {
var y = $(this).scrollTop();
if (y > 1) {
$('.topMenu').fadeIn();
} else {
$('.topMenu').fadeOut();
}

});

关于Jquery 面板 + 从顶部检测滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30758749/

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