我正在使用 zend 框架开发 jquery 移动 Web 应用程序。我使用页脚选项卡和滑动功能使用各种页面导航。
我面临2个问题。
1]我在每个页面的菜单面板中使用 facebook 之类的图标。当我从另一个页面链接返回页面时,它会消失。
我努力了
1)我在 page 的 div 之后包含了我的所有 js 文件(jquery mobile js 除外)。
<div data-role="page" class="swipe-page type-interior" data-prev="previous_page" data-next="next_page">
2) http://jquerymobile.com/demos/1.2.0/docs/pages/page-scripting.html
3)编写脚本函数$(document).on( "pageinit", function() {//function to display facebook like and send message icons. });
<div data-role="panel" data-tap-toggle="false"
id="mypanel" data-position="left" data-display="overlay" >
<div >
<div data-role="header">
<h1 style="color:white">Menu</h1>
</div>
<div style="margin-left: 18%;" class="fb-like" data- href="https://www.facebook.com/EnablingHealthcare?ref=ts&fref=ts" data-send="true" data-layout="box_count" data-width="200" data-show-faces="true"
data-font="lucida grande" data-ajax="false" ></div>
</div>
</div>
而 facebook 的 js 像图标是
$( document ).on( "pageinit", function() {
( function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
return;
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=164648760363128";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
});
2]我通过在 data-prev="previous_page" data-next="next_page" 中提供页面名称,为每个页面添加了滑动功能。使用以下脚本,该脚本保存在单独的 js 文件中并包含在每个页面中。
// swipe functionality logic
var page = "#" + $( this ).attr( "id" ),
next = $( this ).jqmData( "next" ),
prev = $( this ).jqmData( "prev" );
if ( next ) {
// Prefetch the next page
$.mobile.loadPage( next );
// Navigate to next page on swipe left
$( document ).on( "swipeleft", page, function() {
$.mobile.changePage( next );
});
}
if ( prev ) {
$( document ).on( "swiperight", page, function() {
$.mobile.changePage( prev, { reverse: true } );
});
}
在前端设计中它工作得很好,但是当我使用 zend 框架将它与后端数据库集成后在浏览器上测试我的应用程序时。它仅适用于前 3-4 次。之后它开始在 url 中附加页面名称。我在哪里做错了?请提出任何解释