iframe jQuery scope of reference

2019-08-02 20:19发布

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条回答
Summer. ? 凉城
2楼-- · 2019-08-02 21:00

document.parent points you to right direction

$(document.parent).jGlow(title + " has been used");
查看更多
登录 后发表回答