开发者

Is it possible to close prettyphoto modal inside iframe?

开发者 https://www.devze.com 2023-01-07 20:52 出处:网络
I\'m using prettyphoto jquery plugin for lightbox. When somebody clicks on a l开发者_开发问答ink it opens a lightbox iframe.

I'm using prettyphoto jquery plugin for lightbox. When somebody clicks on a l开发者_开发问答ink it opens a lightbox iframe. Inside the iframe there is button that should close the lightbox. in documentation there is a code:

$.prettyPhoto.close();

But don't how to use it properly. So, how to close a lightbox inside iframe.


Since it's in an iframe, it doesn't have access to the same scope that your prettyPhoto plugin is running in.

Assuming the iframe is on the same domain, you can traverse upwards into the parent, and call the function there.

window.parent.$.prettyPhoto.close(); would likely do the trick.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号