Bookmarklet背后的元素 [英] Bookmarklet behind elements

查看:125
本文介绍了Bookmarklet背后的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个书签,会出现一个iframe,它会加载我拥有的网页表单。在大多数网站上,它可以正常使用当前html页面中每个元素顶部的书签。但对于某些加载了大量javascript的网站(例如meebo.com),加载的iframe将会显示在下方。我怎么能麻烦这个?谢谢。附加屏幕截图。

I have a bookmarklet that will come up with a iframe that will load a web form I have. On most site, it works fine with the bookmarklet on top of every element in the current html page. But for certain sites with a lot of javascript loading (e.g. meebo.com), the loaded iframe will go below. How can i troubleshot this? Thanks. attached screen shot.

推荐答案

如果您使用的是可定位元素,例如div,则应确保 z-index 样式设置为高于任何其他元素的值。

If you are using a positionable element such as a div, you should ensure the z-index style is set to a value higher then any other element.

当然,您在iFrame中加载的页面也可能就是这样做的。因此,你可能需要使用一个计时器(setTimeout)来延迟500ms,然后获得当前最高的z-index并为其添加1。

Of course the page you load in the iFrame may also be doing exactly this. Therefore you may need to use a timer (setTimeout) to delay for say 500ms and then get the current highest z-index and add 1 to it.

另外,因为你事先不知道iFrame中显示的页面,你实际上需要手动搜索包含z-Index样式的所有元素。获得这些元素的集合后,获得最高的z-Index值。

Also, because you don't know in advance anything about the page shown in the iFrame, you would actually need to manually search for all elements containing a z-Index style. Once you have a collection of these elements, then get the highest z-Index value.

我肯定会使用jQuery来简化这一过程。

I'd definitely look at using jQuery to make this much easier.

这篇关于Bookmarklet背后的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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