hpique提出了一个问题:HTML book-like pagination,或许与您遇到的问题类似。
回答者Engin Kurutepe给出了该问题的处理方式:
Building on Dan's answer here is my solution for this problem, with which I was struggling myself until just now. (this JS works on iOS Webkit, no guarantees for android, but please let me know the results)
var desiredHeight;
var desiredWidth;
var bodyID = document.getElementsByTagName('body')[0];
totalHeight = bodyID.offsetHeight;
pageCount = Math.floor(totalHeight/desiredHeight) + 1;
bodyID.style.padding = 10; //(optional) prevents clipped letters around the edges
bodyID.style.width = desiredWidth * pageCount;
bodyID.style.height = desiredHeight;
bodyID.style.WebkitColumnCount = pageCount;
Hope this helps...
希望本文对你有帮助,欢迎支持JavaScript中文网
这篇文章分享了解决网页内容按页展示,类似HTMLbook的分页方法,通过JavaScript动态调整列数和页面大小,适用于iOS WebKit,Android可能不适用,值得一试。
778

被折叠的 条评论
为什么被折叠?



