此JS代码与target =“_ blank”属性冲突。我应该添加什么才能使此属性成为排除项?

时间:2016-04-24 05:27:31

标签: javascript jquery

// I understand nothing in JS and work empathically :-)
// This one has been taken from somewhere. Attempts to improve fail :(
// The speed of one transition (fadeIn or fadeOut).
// Full execution time will be:
// (browser navigation time) + speed * 2;
// You can set this to slow, medium, fast, or number of ms.
var speed = 'slow';

$('html, body').hide();
$(document).ready(function() {
    $('html, body').fadeIn(speed, function() {
        $('a[href], button[href]').click(function(event) {
            var url = $(this).attr('href');
            if (url.indexOf('#') == 0 || url.indexOf('javascript:') == 0 || url.indexOf('http') == 0) return;
            event.preventDefault();
            $('html, body').fadeOut(speed, function() {
                window.location = url;
            });
        });
    });
});

排除target="_blank"属性的选项应该是什么样的?我知道它靠近ors(||):-),但是它的完美语法是什么?

0 个答案:

没有答案