jqueryMobile 事件

页面加载完成事件

$(document).on("pageinit","#page",function(){
console.log("页面加载完成")
})

document.on("pageinit","#page2",function(){
console.log("页面加载完成")
})

.on事件 第一个参数指的是什么事件  第二个参数 是指具体哪个绑定的哪个元素 一般用选择器选中

#page1 是指具体哪个绑定的哪个元素 一般用选择器选中

pageinit这个点击事件只能在iphone上有效 安卓无效

也可以这样绑定On事件

div("#page").on("pageinit",function(){

)

$(".click").on("click",function(){
$(this).hide()
})
/* 点击触发*/
$(".tap").on("tap",function(){
$(this).hide()
})
/*taphold长按超过1秒时间*/
$(".taphold").on("taphold",function(){
alert("删除")
})

/*swipe水平滑动超过30px触发的事件*/
$("#page").on("swipe",function(){
alert("滑动")
})

swipeleft:左滑动事件 swiperight:右滑动事件

原文地址:https://www.cnblogs.com/yaomengli/p/6738905.html