Cra*_*lot 5 iphone jquery html5 mobile-safari ios
当有人点击按钮时,会导致出现另一个页面.为了防止tap出现在新页面上的另一个元素级联,我们使用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();
});
Run Code Online (Sandbox Code Playgroud)
复制:
1)在iPhone上,访问www.tekiki.com.
2)点击第一个应用程序图标.这会导致应用页面出现.如果您点击正确的位置,原始点击会导致下载按钮(在应用页面上)被触发.
我们的问题是我们使用自定义代码触发了点击事件。我们通过使用 jQuery Mobile (1.3.2) 解决了这个问题。它很臃肿,但它可以工作并处理所有触摸事件,例如点击和滑动。
| 归档时间: |
|
| 查看次数: |
1081 次 |
| 最近记录: |