Jquery mobile 使用jquery mobile在多个页面上显示故事
我有一个很长的故事,我希望人们通过手机阅读。用户将能够在页面之间来回滑动。我不希望它只是上下滚动。因为所有的手机都有不同的窗口大小,我很难在我的故事创建另一个新页面之前,让它完全填满页面。换句话说,把我的故事分解成一个窗口大小的长度 我尝试过一些jquery,它一次添加一个字符,直到达到窗口大小,但是如果运行的时间超过一个页面,我如何动态创建另一个页面Jquery mobile 使用jquery mobile在多个页面上显示故事,jquery-mobile,Jquery Mobile,我有一个很长的故事,我希望人们通过手机阅读。用户将能够在页面之间来回滑动。我不希望它只是上下滚动。因为所有的手机都有不同的窗口大小,我很难在我的故事创建另一个新页面之前,让它完全填满页面。换句话说,把我的故事分解成一个窗口大小的长度 我尝试过一些jquery,它一次添加一个字符,直到达到窗口大小,但是如果运行的时间超过一个页面,我如何动态创建另一个页面 <style type=text/css> div {height:10em; width:auto;
<style type=text/css>
div {height:10em; width:auto; line-height:1em; font-size:1em; }
</style>
<div id="longContent"><p>Lorem ipsum...</p></div>
<div id="newDiv"></div>
<script>
$(document).on("pageinit",function(){
$('#longContent').each(function(){
var text = $("#longContent").html().split(' '),
len = text.length,
result = [];
var maxHeight = $(window).height();
var newHeight =$("#newDiv").height();
for( var i = 0;newHeight <= maxHeight && i<len; i++ ) {
result[i] = text[i]; }
$("#newDiv").html(result.join(' '));
});
});
</script>
div{height:10em;width:auto;line height:1em;font size:1em;}
同侧眼线
$(document).on(“pageinit”,function(){
$('#longContent')。每个(函数(){
var text=$(“#longContent”).html().split(“”),
len=text.length,
结果=[];
var maxHeight=$(窗口).height();
var newHeight=$(“#newDiv”).height();
对于(变量i=0;新高度