iframe jQuery scope of reference

我是研究僧i 提交于 2019-12-11 10:29:32

问题


I have an iframe in my site and this iframe loads a page with jQuery. It seems that the jQuery is using the iframe dimensions as a reference instead of my actual document. For example, I used an iframe refering to this:

$.jGrowl(title + " has been used");

(jGrowl is a plugin that basically loads a notice on the upper right of the page)

When the notice shows, it is showing on the upper right of the iframe and not the actual document. Is there anyway to get the jQuery to refer to the actual site and not the iframe?


回答1:


document.parent points you to right direction

$(document.parent).jGlow(title + " has been used");


来源:https://stackoverflow.com/questions/6686166/iframe-jquery-scope-of-reference

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!