javascript - jQuery slideToggle keeps repeating -
i have simple jquery code looks this:
$( "#resp-navigation" ).one("click", function() { $( "#navigation" ).slidetoggle(500); });
my html looks this:
<div id="resp-navigation"> ... </div> <nav id="navigation"> ... </nav>
my problem when click on #resp-navigation div, #navigation keeps toggling. meybe know why?
thanks.
if intention have '#navigation' div toggle each time clicks on '#resp-navigation' div, then:
this: $( "#resp-navigation" ).one
should be: $( "#resp-navigation" ).on
and works fine in fiddle:
if, however, intention ever have '#navigation' div toggle once (so disappears , cannot shown again), code no modifications, can see in fiddle:
Comments
Post a Comment