jquery - Bootstrap Dropdown toggle triggered from javascript won't stay open consistently -
jsfiddle fiddle works intended using same exact code site! copy , pasted.
to replicate issue have these steps exactly. go fresh load of page. scroll bottom , click "contact" in middle column. when try , select form
options, dropdown closes. why happening? fiddle has exact same code, js , all. on fresh load, toggle button works intended. once "contact" link brought in, breaks.
here custom script wrote scroll top , open dropdown.
// scroll top , open contact form --> $("a[href='#top']").click(function() { $("html, body").animate({ scrolltop: 0 }, "slow"); return false; }); $("a[href='#top']").click(function() { $('#nav-contact.dropdown-toggle').dropdown('toggle'); return false; }); <!--// end contact form scripts -->
i don't know js i'm trying learn put site personal project enrichment. explanations appreciated.
ideas?
the jsfiddle working fine me too, try this,
$("a[href='#top']").click(function (e) { $("html, body").animate({ scrolltop: 0 }, "slow", function () { $('#nav-contact.dropdown-toggle').dropdown('toggle'); }); return false; });
calling toggle
within callback.
Comments
Post a Comment