Thursday, 15 January 2015

Onclick issue with jquery .toggle() and jquery .load() -


Why double click to open it and double click to close it?

And when I change it with fadetagulle, why does it break AJAX request to load it (this .hrf)?

  $ (document.body). Ready (function ($ ("li.span3 a") (function (e) {$ ('. Content'). Toggle (). Load (this.href); e.preventDefault (); $ ("Li.span3 a") (function (e) {$ ('. Content'). Toggle (); e.preventDefault ();});});});   

What you have done embeds the event handler inside each other, so the second is not defined unless You do not start for the first time:

  $ (document) .ready (function () {$ ("li.span3 a"). Click (function (e) {e.preventDefault (); $ ('. Content') Toggle () [some other check here] {$ ('. Content'). Load (this.href);}});});    

No comments:

Post a Comment