Home  >  Article  >  Web Front-end  >  Ctrl left-click to open a new window. How to implement it by left-clicking directly to expand? _html/css_WEB-ITnose

Ctrl left-click to open a new window. How to implement it by left-clicking directly to expand? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:23:172058browse

http://cloud.feedly.com
Features on this website. This effect will occur when you click on the title of the news. This website is blocked, so you need to use a proxy.
Right-clicking and opening a new window has the same effect as Ctrl-left-clicking.
I looked at the code and couldn’t understand it.


Reply to the discussion (solution)

I can’t find the effect you mentioned, take a screenshot and have a look

Just use the crtlKey to determine the click time, as follows

 $("#divTest").click(function(e) {        if (e.shiftKey) {            alert("Shift + Click");        }        else if (e.ctrlKey) {            alert("Crtl + Click");        }        else if (e.altKey) {            alert("Alt + Click");        }        else {            alert("Click");        }    });

The same is true for the onclick method, see the example of w3cschools: http://www.w3schools.com/jsref/event_ctrlkey.asp

Determine the click time crtlKey is enough, as follows

 $("#divTest").click(function(e) {        if (e.shiftKey) {            alert("Shift + Click");        }        else if (e.ctrlKey) {            alert("Crtl + Click");        }        else if (e.altKey) {            alert("Alt + Click");        }        else {            alert("Click");        }    });

The same is true for the onclick method, see the example of w3cschools: http://www.w3schools.com/jsref/event_ctrlkey.asp Right-click the connection, a new window will open and directly How to achieve different click effects?

Right-clicking a link to open a new window (new tab) is a browser event. It depends on how each browser handles it. crtl click uses javascript to open a new page. Theoretically the effect should be the same.

What’s the difference? Didn’t notice much

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn