如何更改左mose按鈕的默認行爲,以便獲取中間按鈕的默認屬性,但僅限於特定實例?更改特定實例的鼠標按鈕的默認行爲
例如,
<a id="special" href="https://www.google.com">CLICK ME</a>
<a href="https://www.bing.com">CLICK ME</a>
這不是真正的JS只是僞代碼:
$('#special') function tmpSwap {
if(event.button == 1)
Return event as button 2 (aka button(1) is now button(2))
}
}
按鈕1 - 左 按鈕2 - 中間
因此,與特定的命名錨超鏈接留下任何時候點擊腳本運行,後面的行爲等同於鏈接被中間點擊的行爲。
你可能只是尋找在新標籤中打開? – tom
http://stackoverflow.com/questions/1206203/how-to-distinguish-between-left-and-right-mouse-click-with-jquery – mplungjan
我想解決這樣當我右鍵點擊一個鏈接時,它不會將我帶到新打開的選項卡。我想在選項卡在後臺打開時保持在同一頁面上。我瀏覽了很多類似的問題,但我還沒有找到明確的解決方案。 – u24b8