[英]Opening a popup window in the background?
有沒有一種方法可以通過單擊指向新窗口的鏈接來移動到我的瀏覽器的jQuery,所以我只是停留在打開的窗口中。
就像頁面上一樣:
http://www.netvouchercodes.co.uk/expiring-voucher-codes
當您單擊獲取代碼並訪問時,我們在主頁上,並且在后台打開一個窗口。
您如何修改我的代碼以使其起作用:
HTML:
<a href="http://www.yoursite.com/otherLink" class="yourLink">Click here</a>
jQuery:
$('a.yourLink').click(function(event) {
$(this).next('.hiddenDiv').show();
window.open(this.href, '_blank');
$(this).remove();
return false;
});
的CSS
.hiddenDiv{
display:none;
}
彈出窗口在Opera和FF的前景窗口中打開。 您確定只是沒有更改某些瀏覽器設置,以便您的瀏覽器在后台選項卡中打開彈出窗口嗎? 同樣,在單擊鏈接時按住CTRL鍵將在后台將其打開。
href
自動為您完成操作,因此您不需要通過Javascript更改位置。 另外,如果您處理超鏈接的單擊並將其返回為false,則對於您根本沒有單擊的瀏覽器,因此只需刪除window.open並返回false ,則它應該可以解決您的問題:
HTML:
<a href="http://www.yoursite.com/otherLink" class="yourLink">Click here</a>
jQuery的:
$('a.yourLink').click(function(event) {
$(this).next('.hiddenDiv').show();
$(this).remove();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.