jQuery mobile类库使用时加载导航历史的方法简介
网络编程 2021-07-04 21:03www.168986.cn编程入门
这篇文章主要介绍了jQuery mobile开发中加载导航历史的方法,jQuery mobile是jQuery针对移动设备开发的JavaScript库,需要的朋友可以参考下
jQuery.mobile.navigate( url [, data ] )
改变URL和跟踪历史。作品为浏览器和无历史新的API
- url:是必须的参数。类型:字符串
- data:是可选的参数。类型:对象。
更改哈希片段两次然后日志提供导航事件数据时,浏览器向后移动的历史
// Starting at http://example./ // Alter the URL: http://example./ => http://example./#foo $.mobile.navigate( "#foo", { info: "info about the #foo hash" }); // Alter the URL: http://example./#foo => http://example./#bar $.mobile.navigate( "#bar" ); // Bind to the navigate event $( window ).on( "navigate", function( event, data ) { console.log( data.state.info ); console.log( data.state.direction ) console.log( data.state.url ) console.log( data.state.hash ) }); // Alter the URL: http://example./#bar => http://example./#foo window.history.back(); // From the `navigate` binding on the window, console output: // => "info about the #foo hash" // => "back" // => "http://example./#bar // => "#bar"
劫持一个链接点击使用导航方法,然后加载内容
// Starting at http://example./ // Define a click binding for all anchors in the page $( "a" ).on( "click", function( event ) { // Prevent the usual navigation behavior event.preventDefault(); // Alter the url aording to the anchor's href attribute, and // store the data-foo attribute information with the url $.mobile.navigate( this.attr( "href" ), { foo: this.attr( "data-foo" ) }); // Hypothetical content alteration based on the url. E.g, make // an ajax request for JSON data and render a template into the page. alterContent( this.attr( "href" ) ); });
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程