UiUx
UiUx

Reputation: 995

jQuery responsive toggle menu works only once

I am not fluent in responsive and jQuery, this is for my first project into responsive, all are working fine but top menus toggles only once don't know how to solve.

My jQuery:

$("#pull").bind('click touchstart', function () {
        //$(".responsiveMenu, .mobile-responsive-menu").slideToggle();
        $(".responsiveMenu, .mobile-responsive-menu").toggle();
    });
    $(window).resize(function () {
        $(".responsiveMenu, .mobile-responsive-menu").hide();
    });

I've created a fiddle for quick reference please look into my fiddle.

Upvotes: 1

Views: 391

Answers (1)

Jonathan Nicol
Jonathan Nicol

Reputation: 3298

The problem is that you have two elements with the class mobile-responsive-menu:

<div class="mobile-responsive-menu">
    <ul class="mobile-responsive-menu">

Remove that class from the div.

Here is a working fiddle: http://jsfiddle.net/Q6Dss/

Note that to get it working I am only toggling the ul (.mobile-responsive-menu), not the individual buttons (.responsiveMenu), which is overkill.

Upvotes: 2

Related Questions