欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實現(xiàn)錨點scoll效果實例分析

 更新時間:2015年03月10日 10:18:49   作者:hcqenjoy  
這篇文章主要介紹了jQuery實現(xiàn)錨點scoll效果,實例分析了錨點scoll效果的實現(xiàn)技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了jQuery實現(xiàn)錨點scoll效果的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

復制代碼 代碼如下:
$('a[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;
       var obj = document.documentElement;
     if (jQuery.browser.safari)
           obj = document.body
    if (jQuery.browser.msie)
           obj = 'html';
      $(obj).animate({scrollTop: targetOffset}, 1000);
       return false;
     }
   }
});

希望本文所述對大家的jQuery程序設(shè)計有所幫助。

相關(guān)文章

最新評論