When using the popup Stack, I would like to have a new popup take over and be the only popup, either by deleting all other popups or by replacing the content of the existing popup.

I think this may already be possible with creative use of an updateMethod = callback and having the callback go through and call a close function on each existing other popups. Any advice towards this would be appreciated :)

Comments

newtodrupal21’s picture

You can add Popups.close(); in popup.js when it calls the push function. This way everytime a new pop up is called it will close the already open ones. See the piece of code below.
I have added popups.close() just before the push method.

/**
* Manage the page wide popupStack.
*/
Popups.push = function(popup) {
Popups.close(); // inserted this line of code
Popups.popupStack.push(popup);
};

I am very new to drupal and have not tested this for any further issues that might arise coz of this. It worked out well for me.

Todd Young’s picture

That seems to kill the overlay? I'm running IE and applied the patch to close the overlay, that might have something to do with it.

tajindersingh’s picture

Though the thread is 2 years old, even then Just in case anyone reaches here while searching for solution.

In code provided by newtodrupal21, instead of adding Popups.close(); add Popups.removePopup();
It will work fine, without removing overlay.

Finally thanks to newtodrupal21 for the hint.