CSS 3多列中的jQuery offset()方法 [英] jQuery offset() method in CSS 3 multicolumn

查看:72
本文介绍了CSS 3多列中的jQuery offset()方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一些严重的问题,我正在开发一个iOS应用程序,它必须使用CSS multicolum模块在多个列的UIWebView中显示一个html页面。

Got some serious issue here, I'am working on an iOS App which has to display an html page in a UIWebView over several columns using CSS multicolum module.

我正在向页面添加以下CSS规则以完成多列

I'm adding the following CSS rule to the page to accomplish the multicolumn

padding: 0px; height: 850.000000px; -webkit-column-gap: 0px; -webkit-column-width: 620.000000px;

然后我需要在屏幕上找到页面中某些文字的绝对位置。
问题是从jQuery调用offset()方法的工作正常,除了在2列上运行的文本上的那个。

Then I need to find the absolute position on screen for some text in the page. The problem is that any call of the offset() method from jQuery works fine EXCEPT the one on the text running on 2 columns.

例如,对于从第3列末尾开始并在第4列结束的句子,我得到一个偏移量,左边的值设置为第3列但是顶部position设置为0,好像它在第4列中一样。

For example for a sentence that starts at the end of column 3 and finishes on column 4, I get an offset with the left value set to the 3rd column but the top position is set to 0 as if it was in the 4th column.

如何使用正确的left和top值获取offset()值。我的意思是如果左​​边的值在第3列,我希望最高值也在第3列的底部。

How can I get the offset() value with correct left and top values. I mean if the left value is on 3rd column I want the top value to be also at the bottom of the 3rd column.

再次我只有这个问题当句子同时在两列上运行时(从第3列末尾开始到第4列结束)

我真的不喜欢我知道我是否在这里做得很清楚,但任何帮助都会非常棒。

I really don't know if I'm making myself clear here but any help would be really awesome.

提前Thx

推荐答案

我会尝试预处理文本,根据您的需要在每个句子或段落的每个第一个和每个最后一个字符周围添加一个特定的范围。
offset()应该可以检索块的起始位置和结束位置。然后你就可以计算复杂的情况,例如在不同列中开始和结束的句子。

I would try to pre process the text to add a specific span around every first and every last character of each sentences or paragraph depending on your needs. The offset() shoud work to retreive the starting and ending positions of your block. You would have then just to compute the complicated cases like sentences starting and ending in different columns.

这篇关于CSS 3多列中的jQuery offset()方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆