jquery mobile 的事件测试

来源:互联网 发布:嵌入式与单片机 编辑:程序博客网 时间:2024/05/17 01:35

一下脚本测试了jquery 以及jquery mobile的事件触发顺序


某次编程的时候,getBoundingClientRect获取element的大小,永远是0,原来是脚本的调用时机放错了位置;一般在ready处调用

<!DOCTYPE html> <html><head><meta charset="utf-8"><title>[!--pagetitle--]</title><link href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.css" rel="stylesheet" type="text/css"/><script src="http://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script><script>$(document).on("mobileinit", function(){  alert('mobileinit');});</script><script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.js" type="text/javascript"></script></head> <body  class='page-swipe'> <script>alert("script exect");$(document).on('pagebeforechange', function(e, data){  alert('pagebeforechange'); });  $(document).on( "pagebeforecreate", function( event ) { alert('pagebeforecreate'); });  $(document).on("pagecreate", function( event ) {  alert('pagecreate');} );$(document).on("pageinit","#page",function(){alert(' page pageinit');});$(document).on('pageinit', function(){ alert('pageinit');});$(document).on('pagebeforeshow', function(){ alert('pagebeforeshow');});$(document).on( "pagecontainershow", function( event, ui ) {  alert( "pagecontainershow" );});$("#slider").ready(function(){alert(' slider ready');});$(document).ready(function(){alert('ready');});$(function(){alert('jquery execte ready');});$(window).load(function() {alert('window load');});window.onload=function(){alert('onload');}; $( window ).hashchange(function() { alert('hashchange'); });--></script></body></html>


0 0