My personal preference would be to use the display CSS attribute instead of visibility. Also, I would include that setting in a different class that I will not need after the page loads, say "myHiddenDiv". Finally, utilize jQuery chaining so you don't have to scan the DOM twice. So your code would look something like this:
$("#mymenu").removeClass("myHiddenDiv").hide(); Steve On Sunday, December 16, 2012, John M Bliss wrote: > > This seems to work but looks clunky to me. Better solution(s)? > > .mymenuclass { > visibility: hidden; > } > > <head> > <script> > $(document).ready(function () { > $( "#mymenu" ).hide(); > $( "#mymenu" ).css("visibility", "visible"); > }); > </script> > </head> > > > On Sun, Dec 16, 2012 at 1:09 PM, John M Bliss > <bliss.j...@gmail.com<javascript:;>> > wrote: > > > Hi! I'm using jquery to show/hide div containing primary nav. The problem > > is that, on "heavier" pages, the code below does not perform the initial, > > "ready" hide fast enough so you can see the nav flash on before it's > > hidden. What's the best way to address this issue? > > > > <head> > > <script> > > $(document).ready(function () { > > $( "#mymenu" ).hide(); > > }); > > </script> > > </head> > > > > <div id="mymenu" class="mymenuclass" onmouseover="$( '#mymenu' ).show();" > > onmouseout="$( '#mymenu' ).hide();"> > > the menu > > </div> > > > > -- > > John Bliss - http://about.me/jbliss > > > > > > > -- > John Bliss - http://about.me/jbliss > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353498 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm