我有一個標準的下拉菜單,使用jQuery隱藏兒童li
元素。但是,在加載站點後,子元素快速出現並隨後消失(有點像快速閃爍)。我認爲這與Flashlight of -styled-content已知問題毫無關係。整個下拉菜單快速閃爍頁面加載
該網站是希伯來語,但不應該影響任何東西。該網站位於here
如果你想要一個示例HTML + CSS和Javascript代碼,我很樂意在這裏發佈它。
我只是想知道如果有人之前遇到過這個問題。我在Chrome中看到它,並且我沒有真正檢查它是否也發生在IE和Firefox中。
謝謝!
編輯:下面示出HTML/CSS/JS:
HTML:
<ul class="menu">
<li><a href="#">blah</a>
<ul class="sub-menu">
<li><a href="#">blah</a></li>
</ul>
</li>
</ul>
CSS:
/* NAVIGATION -- level 1 */
ul.menu { float: right; list-style-type: none; font-size: 15px; margin-top: 50px; }
ul.menu > li{ float: right; display: inline; position: relative; margin-left: 30px; }
ul.menu li > a { display: block; color: #5c5d5f; text-decoration: none; border-bottom: solid 1px #9b9a95; }
ul.menu li:hover > a, ul.menu li a:hover , ul.menu li.current_page_item > a { color: black; }
body.home .current_page_item > a { }
body.home .current_page_item > a:hover { }
/* NAVIGATION -- level 2 */
ul.menu li > div { display: none; width: 157px; height: 171px; margin-right: -10px; position: absolute; opacity:0; background: url(images/subNav_bg.png) no-repeat top right; }
ul.menu li > div span { height: 15px; background: transparent; display: block; } /* used to push down the menu */
JS:
// navigation menu //
// add hasSubMenu to each li that has one //
$('.menu > li').has('ul').addClass('hasSubMenu');
// wrap with <div> //
$('li.hasSubMenu > ul').wrap('<div />');
$('ul.menu li > div').css('display', 'none');
$('ul.menu li > div').prepend('<span></span>');
$('li.hasSubMenu > a').click(function() {
return false;
});
// add class to <div> for extendedBg //
$('li.extendedBg').find('div').addClass('subBg2');
$('li.hasSubMenu').hover(function() {
// hover on
$(this).addClass('hover').find('div').stop().fadeTo("medium", 1, /* when done fading */
function() {
$(this).find('div').css('display', 'block');
//$(this).find('ul').css('display','block');
}
);
}, function() {
// hover off
$(this).removeClass('hover').find('div').stop().fadeOut();
});
請張貼樣本HTML和CSS。還有jQuery或JS,如果你有。它對我來說工作得很好。 – chepe263 2012-04-19 21:28:18
@ chepe263:發佈html,css和jQuery – Amit 2012-04-19 21:35:18