iPhone 时移动菜单未关闭
Mobile menu doesn't close on iPhone
我听说 the mobile menu on my page(可通过右上角的 3 个水平条图标访问)不会在 iPhone 上关闭。我无法检查自己,因为我没有 Apple 设备(在在线 iPhone 模拟器上它确实可以工作)但我不明白为什么它可以在 Android 而不是 [=18] 上工作=].
这里是控制移动端菜单的JS代码:
$( '#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();
});
效果很好。
(在 Xcode 模拟器和 iPhone 6 (iOS 9.1) 和 iPad Air ( 9.0)).
我删除了下面的部分,它起作用了。不明白为什么它在 iPhone 上有问题。
$( '.mobile_header_menu_inner' ).click(function( event ) {
event.stopPropagation();
});
我听说 the mobile menu on my page(可通过右上角的 3 个水平条图标访问)不会在 iPhone 上关闭。我无法检查自己,因为我没有 Apple 设备(在在线 iPhone 模拟器上它确实可以工作)但我不明白为什么它可以在 Android 而不是 [=18] 上工作=].
这里是控制移动端菜单的JS代码:
$( '#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();
});
效果很好。
(在 Xcode 模拟器和 iPhone 6 (iOS 9.1) 和 iPad Air ( 9.0)).
我删除了下面的部分,它起作用了。不明白为什么它在 iPhone 上有问题。
$( '.mobile_header_menu_inner' ).click(function( event ) {
event.stopPropagation();
});