jquery mobile后退页面不执行,需要刷新一遍才执行
<script>$(document).ready(function(){vartrack_click=0;//trackuserclickon"loadmore"but...
<script>
$(document).ready(function(){
var track_click = 0; //track user click on "load more" button, righ now it is 0 click
var type="<?php echo $_GET['type'];?>";
var total_pages = <?php
require_once("../../DAL/ImgUrl.php");
$class=new ImgUrl();
$class->page_num($_GET['type']);
?>;
$('#main').load("../../DAL/ImgUrl.php", {'action':"page",'page':track_click,'type':type}, function() {
var height=$("img").css("width");
$("img").css("height",height);
track_click++;})
$(window).on("scrollstart",function(){
// 当滚动到最底部以上100像素时, 加载新内容
if ($(document).height() - $(this).scrollTop() - $(this).height()<100)
{
if(track_click < total_pages) //make sure user clicks are still less than total pages
{
showLoader(); //show loading image
$.post("../../DAL/ImgUrl.php", {action:"page",page:track_click,type:type}, function(data) {
$("#main").append(data); //append data received from server
var height=$("img").css("width");
$("img").css("height",height);//图片高度等于图片宽度,图片正方形自适
hideLoader(); //hide loading image once data is received
track_click++; //user click increment on load button
}).fail(function(xhr, ajaxOptions, thrownError) {
alert(thrownError); //alert any HTTP error
hideLoader(); //hide loading image once data is received
});
}
}
});
});
//显示加载器
function showLoader() {
//显示加载器.for jQuery Mobile 1.2.0
$.mobile.loading('show', {
text: '加载中...', //加载器中显示的文字
textVisible: true, //是否显示文字
theme: 'a', //加载器主题样式a-e
textonly: false, //是否只显示文字
html: "" //要显示的html内容,如图片等
});
}
//隐藏加载器.for jQuery Mobile 1.2.0
function hideLoader()
{
//隐藏加载器
$.mobile.loading('hide');
}
</script>
以上是JQ代码,请哪位前辈帮忙看看 展开
$(document).ready(function(){
var track_click = 0; //track user click on "load more" button, righ now it is 0 click
var type="<?php echo $_GET['type'];?>";
var total_pages = <?php
require_once("../../DAL/ImgUrl.php");
$class=new ImgUrl();
$class->page_num($_GET['type']);
?>;
$('#main').load("../../DAL/ImgUrl.php", {'action':"page",'page':track_click,'type':type}, function() {
var height=$("img").css("width");
$("img").css("height",height);
track_click++;})
$(window).on("scrollstart",function(){
// 当滚动到最底部以上100像素时, 加载新内容
if ($(document).height() - $(this).scrollTop() - $(this).height()<100)
{
if(track_click < total_pages) //make sure user clicks are still less than total pages
{
showLoader(); //show loading image
$.post("../../DAL/ImgUrl.php", {action:"page",page:track_click,type:type}, function(data) {
$("#main").append(data); //append data received from server
var height=$("img").css("width");
$("img").css("height",height);//图片高度等于图片宽度,图片正方形自适
hideLoader(); //hide loading image once data is received
track_click++; //user click increment on load button
}).fail(function(xhr, ajaxOptions, thrownError) {
alert(thrownError); //alert any HTTP error
hideLoader(); //hide loading image once data is received
});
}
}
});
});
//显示加载器
function showLoader() {
//显示加载器.for jQuery Mobile 1.2.0
$.mobile.loading('show', {
text: '加载中...', //加载器中显示的文字
textVisible: true, //是否显示文字
theme: 'a', //加载器主题样式a-e
textonly: false, //是否只显示文字
html: "" //要显示的html内容,如图片等
});
}
//隐藏加载器.for jQuery Mobile 1.2.0
function hideLoader()
{
//隐藏加载器
$.mobile.loading('hide');
}
</script>
以上是JQ代码,请哪位前辈帮忙看看 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询