Mobile menu does not close on iPhone

I was told that the mobile menu on my page (accessible through 3 horizontal bars in the upper right corner) does not close on the iPhone, I can’t check myself because I don’t have Apple devices (it works on iPhone simulators), but I I don’t understand why it will work on Android and not on iPhone.

Here's the JS code controlling the mobile menu:

$( '#mobile_menu_icon' ).click(function() {
    if( $( '.mobile_header_menu' ).css( 'right' ) == '-280px' ) { 
        $( '.mobile_header_menu' ).animate( { right: '0' }, open_delay, 'easeInOutExpo' );  
        $( '#wrap' ).animate({ right: '280px' }, open_delay, 'easeInOutExpo' );
        $( 'body' ).addClass( 'overflow_hidden' );
    }
    else { 
        $( '.mobile_header_menu' ).animate({ right: '-280px' }, close_delay, 'easeInOutExpo' );
        $( '#wrap' ).animate({ right: '0' }, close_delay, 'easeInOutExpo' );    
        $( 'body' ).removeClass( 'overflow_hidden' );
    }
    return false;
});
$( document, '.mobile_header_menu_close' ).click(function() {
    if( $( '.mobile_header_menu' ).css( 'right' ) == '0px' ) {
        $( '.mobile_header_menu' ).animate({ right: '-280px' }, close_delay, 'easeInOutExpo' );
        $( '#wrap' ).animate({ right: '0' }, close_delay, 'easeInOutExpo' );
        $( 'body' ).removeClass( 'overflow_hidden' );   
    }
});
$( '.mobile_header_menu_inner' ).click(function( event ) {
    event.stopPropagation();
});
+4
source share
2 answers

I deleted the following snippet and it worked. I don’t understand why this was problematic for the iPhone.

$( '.mobile_header_menu_inner' ).click(function( event ) {
    event.stopPropagation();
});
+3
source

It works great.

( iOS 9.1, 9.0 8.4 Xcode iPhone 6 (iOS 9.1) iPad Air (9.0)).

-1

Source: https://habr.com/ru/post/1614036/


All Articles