$('a[href*="#"]:not([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) +']'); console.log( $('[name=' + this.hash.slice(1) +']')); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top }, 1000); return false; } } });這是個(gè)錨點(diǎn)滾動(dòng)插件,看了下有一點(diǎn)不是很明白,$('[name=' + this.hash.slice(1) +']') 這個(gè)是應(yīng)該怎么理解的?
關(guān)于jq的插件研究
Cats萌萌
2018-09-13 10:10:54