Ivin Raj
Ivin Raj

Reputation: 3429

expanded mobile navbar doesn't collapse after clicking link

The Fixed-to-top navbar when used in mobile view (i.e. clicking a Navbar icon) does not collapse afterwards. the page is loading. so how to stop the page loading in navbar

This is my website link:

LINK

And this is my javascript code

JavaScrpit Code

// Anchors Position
                $('[data-hash]').on('click', function(e) {
                    e.preventDefault();

                    $('body').addClass('scrolling');
                    var target = $(this).attr('href')
                        delay = 0;

                    if($(document).scrollTop() == 0) {
                        $(document).scrollTop($('#header').height());
                        delay = 200;
                    }

                    setTimeout(function() {

                        if ($(window).width() < 991 && $('.nav-main-collapse').hasClass('in')) {
                            $('.nav-main-collapse').collapse('hide');
                            self.scrollToTarget(target);
                            return this;
                        }

                        self.scrollToTarget(target);

                    }, 200);



return this;
            });

            return this;
        },

Below i attached the screen shot

enter image description here

Upvotes: 0

Views: 1052

Answers (1)

Sumit M
Sumit M

Reputation: 650

Add type="button" on

<button class="btn btn-responsive-nav btn-inverse" data-toggle="collapse" data-target=".nav-main-collapse"><i class="fa fa-bars"></i></button>

Upvotes: 1

Related Questions