当前位置:   article > 正文

html文档 手机分页阅读,HTML书本分页(HTML book-like pagination)

html电子书分页

HTML书本分页(HTML book-like pagination)

如何在一个WebKit浏览器中将一个HTML文件的内容分割成一个屏幕尺寸的块来“分页”呢?

每个“页面”应该显示完整的文本数量。 这意味着文本行不能在屏幕的顶部或底部边框中被切成两半。

编辑

这个问题最初被标记为“Android”,因为我的目的是建立一个Android ePub阅读器。 然而,似乎只有使用JavaScript和CSS才能实现该解决方案,所以我扩大了问题的范围,使其与平台无关。

How can I split the content of a HTML file in screen-sized chunks to "paginate" it in a WebKit browser?

Each "page" should show a complete amount of text. This means that a line of text must not be cut in half in the top or bottom border of the screen.

Edit

This question was originally tagged "Android" as my intent is to build an Android ePub reader. However, it appears that the solution can be implemented just with JavaScript and CSS so I broadened the scope of the question to make it platform-independent.

原文:https://stackoverflow.com/questions/3636052

2021-04-08 19:04

满意答案

建立在这里的丹回答我是解决这个问题的办法,直到现在我正在努力奋斗。 (这个JS在iOS Webkit上工作,对android没有保证,但请让我知道结果)

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;

希望这可以帮助...

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...

相关问答

建立在这里的丹回答我是解决这个问题的办法,直到现在我正在努力奋斗。 (这个JS在iOS Webkit上工作,对android没有保证,但请让我知道结果) var desiredHeight;

var desiredWidth;

var bodyID = document.getElementsByTagName('body')[0];

totalHeight = bodyID.offsetHeight;

pageCount = Math.floor(totalHeight/desiredHeigh...

将结果分成多个页面,效率更高,速度更快,并且易于使用服务器。 首先,大多数用户不会考虑第一个X结果,而不管在一个页面上有多少个结果,所以会有大量未使用的结果被检索,处理并发送到客户端,浪费了带宽和CPU时间。 事实上,通过分页,您可以增加他们继续浏览的机会,如果这些内容全部在一个页面上,他们就会停止。 二,如果这只是文本数据,即使对于大量的数据也是非常快速的,但是如果你投入图片和每个结果必须显示的东西,比如在一个目录中,那么事情真的开始放慢速度返回的结果越多。 在SQL中通过LIMIT进行分页是通...

顾名思义,分页用于改变页面(结果)。 所以你必须有一个系统为后续页面提供服务。 创建下一个文件如page1.html , page2.html ...以及在所有页面中链接它将是最简单的方法。 您也可以立即发送所有结果并使用类似于pure css menu (输入+标签+〜(css))的方法隐藏它们 但这非常愚蠢。 (尽管可能) 你必须为此使用一些编程语言。 浏览器端的JavaScript或/和服务器端的东西,例如:PHP,NodeJS,.Net,c#,Python,Perl,Ruby,Java甚至...

我已经通过为分页URL添加过滤器来完成此任务,并且它可以正常使用.html扩展名。 以下是使用.html扩展名运行分页的代码。 add_filter('get_pagenum_link', function($url) {

$current_url_arr = explode("?", $_SERVER['REQUEST_URI']);

$current_url = $current_url_arr[0];

$html = strrpos( $url, '.html' );

$page_nu...

首先,您需要创建一个扩展的CustomPaginator类 Illuminate\Pagination\BootstrapThreePresenter

并覆盖它的方法。 我需要一个自定义类,附加1个onEachSide而不是3个。 所以我这样做了: https://gist.github.com/aykutcan/495d43041571854a7507 First you need to create a CustomPaginator Class that extends Illuminat...

我就是这样做的...... def searchString = "${params.author}%"

def searchResults = Book.findAllByAuthorLike(searchString, params) // max, offset automatically handled

def total = Book.countByAuthorLike(searchString)

render (model:[searchResults: searchResults, ...

您可以将type => 'array'到如下所示的参数中。 <?php

global $wp_query;

$big = 999999999; // need an unlikely integer

$links = paginate_links( array(

'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),

'format' => '?paged=%#%',

'current' ...

还需要在查询中使用限制来限制显示在您所在页面上的记录数。 通常,这可以在setQuery函数中完成,该函数允许第二个和第三个参数设置限制大小和起始位置。 $sql = "SELECT * FROM #__event WHERE published = 1 ORDER BY id DESC";

$db->setQuery($sql, $model->getState('limitstart'), $model->getState('limit'));

$rows = $db->loadO...

我认为你的存储库应该返回一个org.springframework.data.domain.Page而不是List 。 @RepositoryRestResource(collectionResourceRel = "books", path = "books")

public interface BookRepository extends PagingAndSortingRepository {

Page findByTitle(Pageable p...

来自文档 : max (可选) - 每页显示的记录数(默认为10)。 仅在params.max为空时使用 From the docs: max (optional) - The number of records to display per page (defaults to 10). Used ONLY if params.max is empty

相关文章

Book Name:Dealers of Lightning Author:Michael A. Hi

...

Book Report: THE SOUL OF A NEW MACHINE Zhengdong Zh

...

HTML5秘籍的内容摘要:内容简介《HTML5秘籍》共包括四个部分,共12章。第一部分介绍了HTML5

...

这段时间团队一直在做微信端的一些产品设计和开发,当然也包含一定的运营工作。做过的东西也不少,微名片、微

...

Cocos html5 项目环境的搭建。按照官网的文档搭建。(cocos html5 v2.2.3、w

...

有没有什么办法不用框架就可以让html和js代码分离,每写一句html都要用引号和加号忒麻烦. 怎样

...

这段时间团队一直在做微信端的一些产品设计和开发,当然也包含一定的运营工作。做过的东西也不少,微名片、微

...

空格 空格是 HTML 中最普通的字符实体。 通常情况下,HTML 会裁掉文档中的空格。假如你在文档

...

HTML 排版标记包括换行、hr(横线)、p(段落)、pre等 示例: <html>

...

1>页面中直接在script标签中书写 <html><head><

...

最新问答

List lc = driver.findElements(By.cssSelector("table[id*='filter']")); for (WebElement row : lc) { List images = row.findElements(By.tagName("img")); for (WebElement image : images) { image.click(); } } List

我没有任何问题,但我能够通过启用我的弹出窗口拦截器(我使用更好的弹出窗口阻止程序 - Chrome网上应用店 )来重现你在运行Chrome 21.0.1180.89的Windows 7上遇到的问题。 如果您使用弹出窗口阻止程序,请尝试为jsfiddle /您正在使用的站点禁用它。 I didn't have any issues with it, but I was able to reproduce the problem you were having on Windows 7 runnin

opencv已经有开源的人脸识别的代码了,只需要安装一下,有训练好的关于人脸的xml文件,然后根据这两个xml文件,输入一张带有人脸的图片进行检测就好了。参考网址:http://www.cnblogs.com/mengdd/archive/2012/08/01/2619043.html 这里说的更详细一些。matlab是专门针对图像处理的,不过一般的用matlab实现的,用opencv也都可以做的到。有些时候将matlab代码转为opencv还是需要一定时间和一定功底的

您需要使用ProximitySensor来检测手机屏幕何时被覆盖。 这是一个例子: 在android中使用接近传感器 You need to use ProximitySensor to detect when the phone screen is covered. Here is an example: Using proximity sensor in android

我认为找到这个的最简单方法是搜索ProjectName列。 它似乎包含层次结构信息: select c.* from content c where ProjectName+' ' like '%Project 1 %' 额外的空间是确保Project 1与Project 10不匹配。 I found the way to solve. But the actual solution is given by Jayvee. Sorry I didnt know the method it ca

弄清楚了! 它被链接到: searchText: 'Search for a member...', 这将自动填充搜索栏的内容,并尝试根据该搜索词找到用户。 删除此属性解决了这个问题。 Figured it out! It was linked to: searchText: 'Search for a member...', This will autofill the search bar with content and will attempt to find the user

错误2245也可能是密码历史记录问题。 新密码是最近使用的密码吗? 编辑:看起来这个功能在Server 2003 SP 2之后破了。我在使用文档中的示例从C ++调用函数时遇到了同样的错误。 您可能需要使用NetUserSetInfo。 Error 2245 could also be a password history problem. Is the new password one that was used in the recent past? Edit: It looks like

我在网上搜索了很多,为我的问题找到答案。 我花了很多时间,所以我在这里贴出来帮助别人。 为了使GLEW与MinGW一起工作,您应该从GLEW网站下载源代码并放置 来自MinGW \ bin的gcc.exe 来自MinGW32 \ mingw32 \ bin的ar.exe 到GLEWs源文件夹并在该文件夹中创建并运行.bat,如下所示: gcc -DGLEW_NO_GLU -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.o -c src/glew.

使用模板成员函数时,您需要使用template关键字,如下所示: my_postoffice.template get_postbox() 和 po.template get_postbox() cf here: http : //ideone.com/W0owY1代码和这里: 我在哪里以及为什么要放置“template”和“typename”关键字? 有关何时使用模板关键字的确切说明 You need to use the template keyword when using

你不能,至少在Devel :: REPL调用Data :: Dump :: Streamer的情况下。 DDS将始终编码不在\ x20- \ x7e范围内的任何字符。 您可以修改DDS以选择其他方式。 After reading the source of DDS, I came up with this patch based on the Perl Monks code: $ cat quote.rc { no warnings 'redefine'; sub Data::D

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/97457
推荐阅读
相关标签
  

闽ICP备14008679号