iOS 中使用 CSS 多列的电子书(计算不同列中的文本范围)

发布于 2024-10-08 18:26:16 字数 527 浏览 0 评论 0原文

我的第一个问题在这里。如果我做错了什么,请纠正我。

我在这里找到了一个源代码,演示了如何使用 CSS 多列对 html 进行分页。 http://groups.google.com/group/leaves-developers /browse_thread/thread/27e4bf5ff3c53113/f137dc01b6d853b7

我的问题是: 如何计算不同列(页)中文本的范围/位置?

例如,更改字体大小时, 当前页面的文本将跳转到另一页面。 为了解决这个问题,程序应该保存当前的文本位置, 重新格式化网页后移至正确的页面(列)。

它对于实现书签功能也很有用。

我认为这应该由 javascript 完成,但我对 javascript 很陌生。

欢迎任何建议和提示。

My first question here. Correct me if I've done anything wrong.

I've found a source here demonstrate how to paginate html using CSS multi-column.
http://groups.google.com/group/leaves-developers/browse_thread/thread/27e4bf5ff3c53113/f137dc01b6d853b7

My question is:
How to calculate the range / location of text in different column (page)?

For example, when changing the font size,
the text in current page will jump to another page.
To solve this, the program should save the current text location,
and move to the correct page (column) after reformatting the web page.

It is also useful for implementing bookmark function.

I think it should be done by javascript, but I'm new to javascript.

Any suggestions and tips are welcomed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深缘浅 2024-10-15 18:26:16

这是一个有点普遍的问题,很难回答,所以我只是尝试向您指出我可能尝试的方向。

我不知道页面布局的外观或功能如何,但理论上可以做到这一点的一种方法是,每当更改字体大小时检查“列”的文本节点(假设此字体大小更改是由单击按钮)。因此,举例来说,假设您有一个带有 id #column_1 的 div,每当有人单击按钮 ui 元素时,您就可以评估 #column_1 的前几个字符,然后搜索字符串以查找该文本,并加载任何编号。您定义为该文本周围的“页面”的字符,并调用您的渲染方法以“转向”该页面。所以你的函数的流程可能看起来像这样:

zoomControl.click(click event){ //do something when you click the zoom control
var text = findTextofCurrentPage() //get the first bit of text of your current 'page'
renderLargerTextSize() //re-render your 'page' w/ larger text (for user feedback purposes)
renderPageWith(text) //render/navigate to the 'new' page wherein your the text in the variable 'text' can be found
}

显然这是一个超级通用的“想法”,你可以使用什么函数/方法来实现这一点,但我认为如果你深入研究 JS 并说出像 JQuery 这样的东西事情可以相对容易地完成。

This is a bit of a general question, and very hard to answer, so I'll just try to point you in a direction I might try.

I have no idea how the layout of your page might look or function, but one way you could theoretically do this is by checking the text node of your 'column' whenever you change the font-size (presuming this font size change is implimented by a button click). So, for instance, say you have a div w/ the id #column_1, whenever someone clicks the button ui element you could evaluate the first several characters of #column_1, then search your string to find that text, and load whatever no. of characters you have defined as a 'page' around that text and call your render method to 'turn' to that page. So the flow of your function might look something like this:

zoomControl.click(click event){ //do something when you click the zoom control
var text = findTextofCurrentPage() //get the first bit of text of your current 'page'
renderLargerTextSize() //re-render your 'page' w/ larger text (for user feedback purposes)
renderPageWith(text) //render/navigate to the 'new' page wherein your the text in the variable 'text' can be found
}

Obviously this is a super generic 'idea' of what functions/methods you might use to make this happen, but I think if you dug into JS and say something like JQuery this sort of thing could be done relatively easily.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文