$('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; } } });這是個錨點滾動插件,看了下有一點不是很明白,$('[name=' + this.hash.slice(1) +']') 這個是應該怎么理解的?
關于jq的插件研究
Cats萌萌
2018-09-13 10:10:54