jQuery if else else on scroll
我想在滚动停止使用if else时滚动和恢复旧CSS时更改CSS或菜单栏。 这就是我迄今为止所做的。jQuery if else else on scroll
if ($(window).scroll(function() {
$('#nav').css('opacity', '0.85');
} else {
$('#nav').css('opacity', '1');
});
工作没有if语句
$(document).scroll(function() {
$('#nav').css('opacity', '0.85');
});
使用滚动和scrollstop
$(document).on("scroll", function() {
$('#nav').css('opacity', '0.85');
});
$(document).on("scrollstop",function(){
$('#nav').css('opacity', '1');
});
你可以给小提琴一样的 – 2014-09-11 06:32:53
http://*.com/questions/14035083/jquery-bind-event-on-scroll -stop – jbmyid 2014-09-11 06:36:21
scrollstop功能不适用于我 – 2014-09-11 07:51:38
试试这个
scrolling = "Scrolling",
stopped = "Stopped";
$(window).scroll(function() {
console.log(scrolling);
clearTimeout($.data(this, "scrollCheck"));
$.data(this, "scrollCheck", setTimeout(function() {
console.log(stopped);
}, 250));
});
任何小提琴显示代码? – 2014-09-11 06:24:03
'if($(window).scroll' is ... very strange。真正要检查的if if? – Regent 2014-09-11 06:25:12
如果和大括号完全失去联系 – 2014-09-11 06:28:41