需要jquery中bind pageInserted函数的帮助吗
我需要一些帮助来理解如何在index.html文件中使用脚本,以及如何在ajax加载的子页面中使用脚本 在我的索引文件中,我有一个脚本可以在该页面中工作,很好。 现在我想让它与一个单独的html页面一起工作,我用-ajax jquery加载该页面 我想我需要使用.bind('pageInserted')……之类的东西,但我不知道如何使用 该脚本使您可以向上/向下滚动两个div,并可以向后/向下滑动 我索引文件中的脚本(在那里工作)是: 索引文件中的div是:需要jquery中bind pageInserted函数的帮助吗,jquery,function,bind,Jquery,Function,Bind,我需要一些帮助来理解如何在index.html文件中使用脚本,以及如何在ajax加载的子页面中使用脚本 在我的索引文件中,我有一个脚本可以在该页面中工作,很好。 现在我想让它与一个单独的html页面一起工作,我用-ajax jquery加载该页面 我想我需要使用.bind('pageInserted')……之类的东西,但我不知道如何使用 该脚本使您可以向上/向下滚动两个div,并可以向后/向下滑动 我索引文件中的脚本(在那里工作)是: 索引文件中的div是: <div id="pagewr
<div id="pagewrapper">
<div id="pageflip">
<div class="scrollerwrapper">
<div class="scroller">
content in div1 (page1) goes here.........
</div>
</div>
<div class="scrollerwrapper">
<div class="scroller">
content in div2 (page2) goes here.........
</div>
</div>
</div>
</div>
第1部分(第1页)的内容放在这里。。。。。。。。。
第2部分(第2页)的内容放在这里。。。。。。。。。
我希望使用此脚本的子页面demo.html看起来像索引文件中的div+顶部的两个div,以便iscroll脚本工作:
<div id="wrapper22" class="scrollerwrapper">--need this for the iscroll to work
<div id="mag1" class="scroller2">--need this for the iscroll to work
<div id="pagewrapper">
<div id="pageflip">
<div class="scrollerwrapper">
<div class="scroller">
content in div1 goes here.........
</div>
</div>
<div class="scrollerwrapper">
<div class="scroller">
content in div2 goes here.........
</div>
</div>
</div>
</div>
</div>
</div>
——iscroll需要这个才能工作
--需要这个才能让iscroll正常工作
第1部分的内容放在这里。。。。。。。。。
第2部分的内容放在这里。。。。。。。。。
我真的很想得到一些帮助,让学生了解如何解决这个问题,并让它发挥作用。
非常感谢!您是否使用jQuery中的.load()
通过AJAX加载页面?用于
.load()
。它允许您在加载内容时设置回调:
$('#result').load('ajax/test.html', function() {
alert('Load was performed.');
});
嗨,罗夫福
我想我是:-),我使用jqtouch和jquery加载页面(这是一个移动应用程序)。我正在使用此脚本使iscroll在子页面上工作:
var myScroll;
$(document.body).ready(function(){
$('#hem').load('home/home1.asp');
loaded();
$(this).bind('pageInserted', function(event, info) {
var $inserted = info.page;
var $scroll = $inserted.find('.scroller2');
var elm = $inserted.find(".scrollerwrapper");//document.getElementById('wrapper2');
if (elm != null)
elm.css("height", window.innerHeight);//elm.style.height = window.innerHeight + "px";
myScroll= new iScroll($scroll.attr("id"), {desktopCompatibility:true,hScrollbar: false,vScrollbar: false});
});
});
var myScroll;
$(document.body).ready(function(){
$('#hem').load('home/home1.asp');
loaded();
$(this).bind('pageInserted', function(event, info) {
var $inserted = info.page;
var $scroll = $inserted.find('.scroller2');
var elm = $inserted.find(".scrollerwrapper");//document.getElementById('wrapper2');
if (elm != null)
elm.css("height", window.innerHeight);//elm.style.height = window.innerHeight + "px";
myScroll= new iScroll($scroll.attr("id"), {desktopCompatibility:true,hScrollbar: false,vScrollbar: false});
});
});