我没有显示整个代码,它与cms自定义标签集成,但这是基本问题。我有以下滚动代码:
$(function(){
$(window).scroll(function() {
var top = $(document).scrollTop();
if (top < 174) $(".nav-wrap").css({top: '0', position: 'relative'}),
$("#cssmenu > ul ul#cm-cur").addClass( "cm-cur" ); //making dropdown ul menu visible
else $(".nav-wrap").css({top: '0px', position: 'fixed'}),
$("#cssmenu > ul ul#cm-cur").removeClass( "cm-cur" ); // hide dropdown ul menu when scroll
});
});
下一个:
$( "#cssmenu > ul li.active#drop" ).mouseout(function() {
t = setTimeout(function(){
$("li.cur-page#drop").css({background: '#EDF1F7'});
}, 2000);
});
我尝试使用不同的值将第二个代码粘贴到第一个代码中两次:
$(function(){
$(window).scroll(function() {
var top = $(document).scrollTop();
if (top < 174) $(".nav-wrap").css({top: '0', position: 'relative'}),
$("#cssmenu > ul ul#cm-cur").addClass( "cm-cur" ), //making dropdown ul menu visible
$( "#cssmenu > ul li.active#drop" ).mouseout(function() {
t = setTimeout(function(){
$("li.cur-page#drop").css({background: '#EDF1F7'});
}, 2000);
});
else $(".nav-wrap").css({top: '0px', position: 'fixed'}),
$("#cssmenu > ul ul#cm-cur").removeClass( "cm-cur" ), // hide dropdown ul menu when scroll
$( "#cssmenu > ul li.active#drop" ).mouseout(function() {
t = setTimeout(function(){
$("li.cur-page#drop").css({background: 'none'}),
$("#cssmenu > ul li ul#cm-cur").removeClass( "cm-cur" ); // after menu hovered, this dropdown ul disapeares, but with delay
}, 2000);
});
});
});
它不起作用