V
V
Vasily Ivanov2022-02-04 10:36:21
JavaScript
Vasily Ivanov, 2022-02-04 10:36:21

The menu on the mobile version of the site (Bitrix) does not open in all browsers. What could be the reason?

Hello.

The site is on Bitrix, the menu does not open in all mobile browsers.
from observations
Opens on IOS: Chrome, Yandex
Does not open IOS: Safari; Android: Chrome, Yandex

From PC, when the site is resized to the mobile version, the menu works correctly, the console does not give errors

Tell me, what could be the reason?

mobileMenu.js

;(function($, window, document, undefined){

  var buttonNextLevelHtml = '<span class="arrow js-arrow">&rsaquo;</span>',
    buttonPrevLevelHtml = '<li class="back js-back">Назад</li>',
    toggle = $('.js-toggle'),
    overlay = $('.overlay'),
    body = $('body'),
    menu = $('.multilevelMenu'),
    link = menu.find('a'),
    menuList = menu.find('li').find('ul');

  //create animate-menu function
  function openMenu() {
    body.toggleClass('fixed');
    setTimeout(function() { $('.close-list').removeClass('close-list') }, 400);
  };

  //animate menu function Call
  toggle.add(overlay).on("click", function(){
    openMenu();
  });
  //the end animate menu function Call

  //add switch-button for children ul
  link.append(function(indx, val){
      var out = '';
      if($(this).parent('li').find('ul').length != 0) {
        out = buttonNextLevelHtml;
      }
      return out
    });

  //add back-button
  menuList.prepend(buttonPrevLevelHtml)

  //var block-two
  var buttonNextLevel = $('.js-arrow'),
      buttonPrevLevel = $('.js-back');

  //view next level menu
  $(link).on("click", ".js-arrow", function(e){
    e.preventDefault();
    e.stopPropagation();
    $(this).parents('ul').addClass('close-list');
    $(this).closest('li').children('ul').addClass('active-menu');
  });



  //view prev level menu to click "back"
  buttonPrevLevel.on("click", function(e){
    $(this).closest('ul.close-list').removeClass('close-list');
    var self = this;

    setTimeout(function() {
      console.log($(self).closest('ul'));
      $(self).closest('ul').removeClass();
    }, 400);

    if($(this).parent().parent().parent().parent().hasClass('multilevelMenu')) {
        $('.menuSearch').removeClass('none');
    };

  });

  //Hidden search-block
    buttonNextLevel.on("click", function(){
      $('.menuSearch').addClass('none')
    })

})(jQuery, window, document);

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