How does the magnificPopup plug-in of jQuery close the pop-up window through the Custom button?

Source: Internet
Author: User

Open the magnificPopup window:

function showWin(Ids) {$.magnificPopup.open({items : [{src : currentDomain+'/igc/admin_selected_goods.html?Ids='+ Ids,type : 'iframe',height : '150px',width : '500px'}]});return $.magnificPopup.instance;}

Close Window

function closeWin(popWin){popWin.close();}

View the showWin method. The pop-up window is of the iframe type. In other words, to close the current magnificPopup window on the new page, the idea is as follows:

1. define A global _ instance variable on page A, and call the showWin method to assign the returned value to the _ instance variable;

var _instance;_instance = showWin(value);

2. Define A closePopWin Method on page A, and call the closeWin (_ instance) method in it;

function closePopWin(){closeWin(_instance);}

3. Call the closePopWin Method on page A on page B.

function closePop(){window.top.frames[1].frames[1].closePopWin();}

4. Add a button on page B to call the closePop method.

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.