A
A
Alexander Andreev2019-03-15 17:23:07
JavaScript
Alexander Andreev, 2019-03-15 17:23:07

Why can Google maps break some jQuery functions?

The site has a mobile menu "sandwich", shown on mobile resolutions. By clicking on the icon, a block with menu items opens. Everything is insanely simple. The code:

//Mobile nav
  $('.hamburger').click(function(e){
             $(this).toggleClass('is-active');
             $('body').toggleClass('mobile-nav-opened');
             $('.header-input-mobile').removeClass('header-input-mobile-active');
             $('.header-search-mobile').removeClass('header-search-mobile-active');
             $('.header-search-mobile').toggleClass('header-search-mobile-disable');
  });


Everything works fine on all pages of the site except those that have a google map. There are no errors in the console, in fact there is nothing in the console at all, but clicking on the icon stops working. Moreover, if the code above is inserted into the console, everything starts working. Tried wrapping it in $(document).ready() - didn't help. What could be the problem (once again there are no warnings or errors in the console)?

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