jQueryMobile的事件,jQueryMobile事件
以下列舉了jQueryMobile的常用事件:
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>page樣本</title> <link rel="stylesheet" type="text/css" href="jquery.mobile-1.4.5.min.css"> <script src="jquery-1.11.1.min.js"></script> <script src="jquery.mobile-1.4.5.min.js"></script> <script> //頁面載入事件 $(document).on("pageinit",function(){ //觸摸事件 $("#p1").on("tap",function(){ $(this).hide(); }); //長按事件 $("#p2").on("taphold",function(){ $(this).hide(); }); //左右滑動事件 $("#p3").on("swipe",function(){ $(this).hide(); }); //右滑動事件 $("#p4").on("swiperight",function(){ $(this).hide(); }); //滑動開始事件 $(document).on("scrollstart",function(){ alert("開始滑動") }); //滑動停止事件 $(document).on("scrollstop",function(){ alert("停止滑動") }); }); </script></head><body><div data-role="page" id="page_one"> <div data-role="header" data-position="fixed"> <h1>歡迎來到首頁</h1> </div> <div data-role="main"> <p id="p1">點擊我隱藏</p> <p id="p2">長按我隱藏</p> <p id="p3">滑動我隱藏</p> <p id="p4">右滑我隱藏</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> <p>嘻嘻哈哈</p> </div> <div data-role="footer" data-position="fixed"> <h1>底部</h1> </div></div></body></html>
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。