简体   繁体   中英

Single mouse click to open new tab + modal window at same time

See for example:

http://www.retailmenot.com/view/macys.com

When you click on one of the buttons, it both automatically opens a new tab, and pop out their modal window.

What are the possible ways to do this?

They seem to do both actions with Javascript. They actually do something that keeps the window in the current tab and not on the one that was opened. How is it done?

In general, Can I achieve these two actions (nevermind if focus is on new window) with a regular form submission with target=_blank the new tab, and some class to pop the modal window? What should the javascript look like?

Is there any way to do this without javascript at all?

Basically I'm looking for practices that are supported from IE8+, and cross browser compliant.

See this : http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open

You can open your js modal also inside myFunction() function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM