http://enure.net/dev/hide-all-except-one/
The issue is that on a page with other content, the images I have placed in the toggleThis divs loads before everything is ready and they briefly appear stacked below, before disappearing when they snap into place. hiddeAllExcept. js does use $(document).rea dy(function() {
I had this same issue with jCarousel, only the dynamically loaded version did not do this. Any input on a workaround appreciated.
Expand|Select|Wrap|Line Numbers
- <!-- import the DOM logic from external javascript files -->
- <script type="text/javascript" src="http://enure.net/_js/jquery.min.js"></script>
- <script type="text/javascript" src="http://enure.net/dev/hide-all-except-one/hideAllExcept.js"></script>
- <style type="text/css">
- .hide { display: none; } /* required */
- body { background-color: #ffffff; }
- #wrapp { margin: 0; padding: 0; width:300px; background-color: white;}
- #ccc;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc; font-family: 'arial', helvetica, sans-serif; font-weight: bold; font-size: 70%;}
- ul { padding-left: 0; padding-bottom:0 }
- li { float: left; display: block; margin-right: 0.1em; }
- ul#buttons {
- margin: .1em .1em .1em .1em;
- font-family: arial, helvetica, sans-serif;
- font-weight: bold;
- font-size: 70%;
- }
- ul#buttons li { padding: .1em .1em .1em .1em; border-right: 1px solid #000; border-left: 1px solid #000; border-top: 1px solid #000; border-bottom: 1px solid #000; border-bottom: 0;
- background-image: url(tabsBG.gif);}
- div#toggleThis { margin-top: 0; margin-bottom:0; border-left: 1px solid #ccc;border-right: 1px solid #ccc;}
- div#toggleThis div { padding: 0; color: #000; border-left:#eee; font-family: georgia, serif; }
- a, a:link, a:visited { color: #111; text-decoration: none; }
- a.active, a:hover { color: red; }
- </style>
- </head>
- <body>
- <div id="wrapp">
- <ul id="buttons">
- <li><a class="toggle" href="#one"> one </a></li> <!-- The js looks for any links with a class of 'toggle'. It then makes visible the id which matches the href. -->
- <li><a class="toggle" href="#two"> two </a></li>
- <li><a class="toggle" href="#three"> three </a></li>
- </ul>
- <div id="toggleThis"> <!-- the js looks for an id of 'toggleThis' and divs inside of it. -->
- <div id="one"><br /><br /><br />DIV ONE CAN HAVE ANYTHING IN IT INCLUDING IMAGES
- </div>
- <div id="two"><br /><br /><br />DIV TWO CAN HAVE ANYTHING IN IT INCLUDING IMAGES
- </div>
- <div id="three"><br /><br /><br />DIV THREE CAN HAVE ANYTHING IN IT INCLUDING IMAGES
- </div>
- </div>
- </div>