K
K
Konstantin Khairov2019-05-22 04:08:06
Bootstrap
Konstantin Khairov, 2019-05-22 04:08:06

Why doesn't collapse open if you click on it while the page is loading?

Hello. Here's the thing, there is a menu made through collapse. But the trouble is that if, when loading the page, quickly click on the icon without waiting for the full load, the menu will not open, and if you wait after that the page is fully loaded, no matter how much you click on the menu, it will no longer open.
If you do not press at the time of loading, then everything works fine.
here is the call button

<script>
$('.navbar-logo').on('click', function () {
     $(".collapse-menu-logo").collapse('show');

        $('#navbarSearch').each(function(){
            $(this).collapse('hide');
        });
  });
</script>
 <button class="navbar-logo"  data-toggle="collapse" data-target="#navbar-logo"  aria-expanded="false">
            <div class="field_width_menu"></div>
            <div class="field_width_menu"></div> 
            <div class="field_width_menu"></div>	
            </button>

And here is the collapse block itself
<div class="collapse collapse-menu-head" id="navbarToggleExternalContent">
  <div class="col-sm-2 col-xs-2">

....

     </div>
</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question