j查询菜单幻灯片错误
jquery menu slideshow error
我目前正在制作一个网站,其中包含一个菜单导航,该菜单导航几乎与在 fotopunch.com 找到的菜单导航相同,而不是指向上方。无论如何,我使用jquery/javascript为菜单编写了代码,它可以工作,但是在Fotopunch站点上也发生了一个小错误。当您将光标从一个菜单项移动到另一个菜单项并反复返回时,它会暂时弄乱显示。有没有办法解决这个问题?我将包含我的javascript文件的一部分,以便您可以看到我为每个菜单项做了什么。
$("div#menu .reps").hover(function() {
//if the current slide is not reps
if(current_slide != "reps"){
//move the arrow to the corresponding position for the reps slide
$(".arrow").animate({"left":"135px"});//move the arrow
//(test which slide it is.)
if(current_slide == "clients"){
//fade out & hide the current slide
$(".clients_display").fadeOut().hide();//hide the current slide
//show the reps slide & fade in
$(".reps_display").fadeIn().show();//show the slide
//the current slide is the reps slide
current_slide = "reps";
}
else if(current_slide == "services"){
//fade out & hide the current slide
$(".services_display").fadeOut().hide();//hide the current slide
//show the reps slide & fade in
$(".reps_display").fadeIn().show();//show the slide
//the current slide is the reps slide
current_slide = "reps";
}
else{
//fade out & hide the current slide
$(".training_display").fadeOut().hide();//hide the current slide
//show the reps slide & fade in
$(".reps_display").fadeIn().show();//show the slide
//the current slide is the reps slide
current_slide = "reps";
}
}
});
我为每个菜单项执行此操作(有 4 个)。我认为问题是当它淡出并淡入时,因为如果它试图同时做太多事情,它会同时显示 2 个菜单div。我尝试添加超时,但没有成功。修复此错误的最佳方法是什么?它足够小,不是一个重要的优先事项,但让它更好地工作会很好。谢谢。
if(current_slide == "clients"){
$(".clients_display")stop(true, true).fadeOut().hide();
$(".reps_display").stop(true, true).fadeIn().show();
current_slide = "reps";
} else if(current_slide == "services"){
$(".services_display").stop(true, true).fadeOut().hide();
$(".reps_display").stop(true, true).fadeIn().show();
current_slide = "reps";
} else{
$(".training_display").stop(true, true).fadeOut().hide();//hide the current slide
$(".reps_display").stop(true, true).fadeIn().show();//show the slide
}
相关文章:
- 幻灯片滚动javascript不起作用
- Node.js v6.2.0类扩展不是函数错误
- 灯箱中的幻灯片转换错误
- 未捕获引用错误:幻灯片未定义
- WordPress幻灯片插件错误
- 未捕获的类型错误:Wordpress Jquery 幻灯片 - 对象没有方法
- 悬停快速幻灯片错误
- JQuery UI - 滑块更改幻灯片上的不透明度 - 错误
- 面对此错误“ 未捕获的引用错误:幻灯片索引未定义 ”在光滑.js
- j查询菜单幻灯片错误
- 尝试在drupal站点上使用响应式幻灯片,但收到控制台错误
- 未捕获的类型错误:对象 [对象对象] 没有方法“幻灯片”
- JQuery 幻灯片错误.图片在页面上列出,而不是随机播放.找不到错误
- 离子框架错误 - 幻灯片框不滑动
- 经过多次迭代后出现javascript幻灯片错误
- Javascript幻灯片循环两次很好,然后出现错误
- 幻灯片停止工作控制台显示没有相关错误?但是这个无关
- 错误:危险的滑动器 - 带有淡入淡出的嵌套垂直幻灯片
- 未捕获的类型错误:无法设置未定义的幻灯片的属性“src”
- Javascript/Jquery幻灯片效果发生在错误的地方