[英]Mobile menu doesn't close on iPhone
我被告知我的頁面上的移動菜單 (可通過右上方的3個水平條圖標訪問)在iPhone上沒有關閉。 我無法檢查自己,因為我沒有Apple設備(在線iPhone模擬器上它確實有效)但我不明白為什么它可以在Android而不是在iPhone上運行。
這是控制移動菜單的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();
});
我刪除了以下部分並且它有效。 不明白為什么它在iPhone上有問題。
$( '.mobile_header_menu_inner' ).click(function( event ) {
event.stopPropagation();
});
它工作得很好。
(在Xcode模擬器和iPhone 6(iOS 9.1)和iPad Air(9.0)上測試iOS 9.1,9.0和8.4)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.