javascript - .click(function(e)) - why do I have to click twice for function to work? -


i have scoured these boards , have seen similar issues yet still cannot life of me figure out why have click dropdown menu twice function fire. after second click menu toggles between visible , hidden single click should.

here script:

$(document).ready(function() {      $('#click-nav .nav-item.has-dropdown').click(function(e) {         e.preventdefault();          var subnav = $(this).attr('data-sub-nav');          $('#click-nav .has-dropdown-icon').html('+');          if ($(this).hasclass('active')) {             $(this).removeclass('active');             $('#secondary-navigation').slideup(500, 'easeinquint', function() {                 $('#secondary-navigation .sub-nav').hide();             });         } else {             $('.has-dropdown-icon', this).html('-');             $('#click-nav .nav-item.has-dropdown.active').removeclass('active');             $(this).addclass('active');             $('#secondary-navigation .sub-nav').hide();             $('#secondary-navigation .sub-nav#' + subnav).show();             $('#secondary-navigation').slidedown(500, 'easeoutquint');         }     }); 

here our website: http://joriebreonn.com/ - can see upon initial page load need click on menu item + twice dropdown menu appear. yet after need click on menu items once function work.

obviously novice , appreciate insight. thank in advance help!


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -