在线一区二区三区高清视频,国产精品妇女一二三区,美女被遭强高潮网站在线播放,实拍各种胸走光见奶头

點(diǎn)擊錨鏈接---URL可以不變

時(shí)間:2016-08-22 10:19:00 類型:JS/JQUERY
字號(hào):    

網(wǎng)站中使用錨鏈接的地方隨處可見(jiàn),很多時(shí)候看到錨鏈接地址很不舒服,如果點(diǎn)擊錨鏈接,但URL可以不變,那就好了, 方法當(dāng)然是有的

// JavaScript Document
$(function(){   
    $('a[href*=#],area[href*=#]').click(function() {
        if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({
                    scrollTop: targetOffset-58
                },
                1000);
                return false;
            }
        }
    });
})