css - jquery only working once -


i've got ul hidden list elements in default state:

$(function () {     $("li.closed > ul").hide(); }); 

on click show hidden list elements toggling.

$("ul > li.closed").click(function () {     var li = $(this).closest('li');     li.find(' > ul').slidetoggle('fast');     $(this).toggleclass("closed open"); }); 

everything working fine. when visit page , return previous, toggle not working anymore - when click toggle out , instantly toggle in.

i'm loading links in div this:

$(".link").click(function (e) {     // prevent default action of event     e.preventdefault();     var linkhref = this.id + '.html';     $("#content").load(linkhref);     $("#nav a.active").toggleclass('inactive active');     $(this).addclass("active").removeclass('inactive'); }); 

and therefore html pages exists of body part , i'm loading global.js everytime again, problem (with caching or something)? this:

<script src="js/global.js" type="text/javascript"></script>  <article>         <ul>         <li class="closed">headline             <ul>                 <li class="fl"><a href="#"><img src="x.png"></a></li>                 <li class="fl"><a href="#"><img src="x.png"></a></li>             </ul>         </li>     </ul> </article> 

instead of having -

$(function () {     $("li.closed > ul").hide(); });   

remove above jquery code , insert css

li.closed > ul {     display:none; } 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -