[英]Menu fade still on hover state on Chrome & Safari
I'm developing a new Joomla 2.5 website and I have to implement a fade effect on the menu for the first level of li only. 我正在开发一个新的Joomla 2.5网站,并且仅在第一级li上必须在菜单上实现淡入淡出效果。
Site url: http://goo.gl/Eu9Mt 网站网址: http : //goo.gl/Eu9Mt
I added this effect but I have a problem on "Google Chrome" & "Safari" only. 我添加了此效果,但仅在“ Google Chrome”和“ Safari”上有问题。 When I hover the mouse on a sub menu and move the mouse away but without hover the parent menu the fade effect still exist but when I move the mouse away and the last item I hovered was the parent item, the fade effect execute correctly.
当我将鼠标悬停在子菜单上并移开鼠标但不悬停父菜单时,淡入淡出效果仍然存在,但是当我将鼠标移开并且悬停的最后一个项目是父项时,淡入淡出效果正确执行。
here is my jQuery code: 这是我的jQuery代码:
(function($){
$(document).ready(function () {
$('#ja-mainnav ul.level0 li').not('#ja-mainnav ul.level0 li ul li').append('<div class=\'hover\'><div><\/div><\/div>');
$('#ja-mainnav ul.level0 li').not('#ja-mainnav ul.level0 li ul li').hover(
function() {
$(this).children('div').stop(true, true).fadeIn('1000');
},
function() {
$(this).children('div').stop(true, true).fadeOut('fast');
}).click (function () {
$(this).addClass('selected');
});
});
})(jQuery);
Please advise 请指教
add this on your css: 将此添加到您的CSS上:
#ja-mainnav li.haschild .hover {
background-image: none;
}
#ja-mainnav li.haschild-over.over .hover {
background-image: url("../../images/nav/menu_over.gif");
}
#ja-mainnav li.haschild .hover div {
background-image: none;
}
#ja-mainnav li.haschild-over .hover div {
background-image: url("../../images/nav/menu_overspan.gif");
}
to add a transition with pure css, you can apply this on the hover stage (for example): 要添加具有纯CSS的过渡,您可以将其应用于悬停阶段(例如):
-webkit-transition: all 0.3s ease-out; /* Safari 3.2+, Chrome */
-moz-transition: all 0.3s ease-out; /* Firefox 4-15 */
-o-transition: all 0.3s ease-out; /* Opera 10.5–12.00 */
transition: all 0.3s ease-out; /* Firefox 16+, Opera 12.50+ */
no IE support I'm afraid 恐怕没有IE支持
hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.