![]() |
JQuery display none menu loading first as block
Hi,
I have a menu and if you hover over the headings it shows an inline sub menu. The problem I have is that the page loads and for a second shows the full menu with all the subs before hiding the subs and just showing the top navigation headings. I have tried .css ('visibility', 'hidden') $.('.ul').css('visibility', 'hidden') $('.topnav > li > ul').hide(); I have added and removed visibility:hidden; from the style sheet relating to this ul. I am completely out of ideas but it looks really messy having everything showing for that second. Here is my code: Code:
$('.topnav > li > ul').css('display', 'none'); |
1. you can just use plain old CSS to take care of it
2. you dont need those functions css: Code:
.topnav li ul{Code:
Code:
$(".topnav > li").hover( |
The reason is because the HTML is being written before the JS changes the style. You need to use your style sheet to hide the elements.
edit: yeah, what he said ;) |
This is how my style sheet looks:
Code:
.topnav{ |
Thank you. That worked. I think it was just taking a while for the new style sheet to be read.
|
| All times are GMT +1. The time now is 03:33 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.