Greasy Fork is available in English.

議論 » 開発

Open div data-href in a new tab

§
投稿日: 2016/04/24

Open div data-href in a new tab

the page have a script that force open link in the current tab (_self) Im trying open in a new tab.
I did but it continues to open on the current tab and a new one.
$('.giveaway-links').click(function(){
var url = $(this).attr('data-href');
var win = window.open(url, '_blank');
});


the page function
init: function() {
this.bindHomepage(), 0 == $(".orbit-container").length && (this.bind(), this.countDown())
},
bindHomepage: function() {
$(".giveaway-links .created-by, .giveaway-links ul").click(function(a) {
var b = $(this).parent().parent().attr("data-href");
window.location = b
})
},


Any idea how to proceed?

woxxomMod
§
投稿日: 2016/04/24

Try deleting the click handler registration:

jQuery._data(document,'events').click.some(function(handler, index, arr) {
    if (handler.selector == ".giveaway-links .created-by, .giveaway-links ul") {
        arr.splice(index, 1);
        return true;
    }
});
§
投稿日: 2016/04/28
編集日: 2016/04/29

what I've done doesn't solve the issue but allow opening in new tab while click on img or title:

$(".giveaway-links").each(function() {
var url = $(this).attr('data-href');
$("[href='"+url+"']").attr('target','_blank');
});

i see it as a temporary solution
regards ^^

返信を投稿

返信を投稿するにはログインしてください。