如何获取UIWebView中元素的位置? [英] How to get position of an element in UIWebView?

查看:87
本文介绍了如何获取UIWebView中元素的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iPad程序中加载了带有HTML的UIWebView。通过使用-webkit-column-width,我将html分成了几列。

I have UIWebView loaded with html in my iPad Program. By using -webkit-column-width, I divided the html with several columns.

padding: 0px
height: 1024px
-webkit-column-gap: 0px
-webkit-column-width: 768px

如何在webview中获取元素位置(x,y)?该位置是在屏幕上的位置,而不是在HTML中。所以y的范围从0到webview的高度。

How can i get the element position(x, y) in webview? The position is on the screen position, not in the html. So y is in range from 0 to height of webview.

预先感谢。

推荐答案

函数

Ok, i solved using jquery function

var p  = $("tag");
var position = p.position();

我得到真正的x,y值。谢谢。

I gets real x, y values. Thanks.

这篇关于如何获取UIWebView中元素的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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