Team:NCTU Formosa/source/head

From 2013.igem.org

(Difference between revisions)
Line 23: Line 23:
         adjustStyle($(this).width());
         adjustStyle($(this).width());
     });
     });
-
});
+
    $('a[href*=#]').click(function() {
-
$('a[href*=#]:not([href=#])').click(function() {
+
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
-
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')  
+
         && location.hostname == this.hostname) {
-
         || location.hostname == this.hostname) {
+
            var $target = $(this.hash);
-
 
+
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
-
        var target = $(this.hash);
+
            if ($target.length) {
-
        target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
+
                var targetOffset = $target.offset().left;
-
          if (target.length) {
+
                $('html,body').animate({scrollLeft: targetOffset}, 1000);
-
            $('html,body').animate({
+
                return false;
-
                scrollTop: target.offset().top
+
            }
-
            }, 1000);
+
-
            return false;
+
         }
         }
-
     }
+
     });
});
});
</script>
</script>

Revision as of 05:55, 29 August 2013