当有人点击一个按钮时,它会导致出现另一个页面。为了防止点击向下级联到出现的新页面上的另一个元素,我们使用 preventDefault。我们已经将此视为 StackOverflow 上其他地方问题的解决方案。但是,它对我们不起作用。
代码:
// Bind what happens when user taps on app
$( '#templates .app_box' ).on( 'tap', function( ev ) {
// Get itunes ID
APP_PICKED = $( this ).attr( 'itunes_id' );
// If on category page, update category history with new path
if ( panabee_get_active_page().attr('id') == 'category_page' ) {
// Get app path and scrub app from it
var app_path = $(this).attr( 'path' );
app_path = app_path.substring( 0, app_path.lastIndexOf(PATH_DELIMITER) );
// Convert path string into array and store in history
CATEGORY_PICKED_HISTORY = get_path_array( app_path );
}
// Show app
if ( playing_game() ) {
play_app_game( this );
} else {
panabee_change_page( '#app_page' );
}
// Prevent double tap
ev.preventDefault();
});
复制:
1) 从您的 iPhone 访问 www.tekiki.com .
2) 点击第一个应用程序图标。这会导致出现应用程序页面。如果您点击正确的位置,最初的点击会触发下载按钮(在应用程序页面上)。
最佳答案
我们的问题是我们使用自定义代码触发了点击事件。我们改用 jQuery Mobile (1.3.2) 来修复此问题。它很臃肿,但可以正常工作并处理所有触摸事件,例如点击和滑动。
关于jquery - 点击一个元素触发点击出现在移动版 Safari 同一位置的另一个元素(幽灵点击),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17768240/