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*=#]').bind('click', function(e) {
-
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
+
e.preventDefault();
-
        && location.hostname == this.hostname) {
+
var target = $(this).attr("href");  
-
            var $target = $(this.hash);
+
-
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
+
$('html, body').stop().animate({ scrollTop: $(target).offset().top }, 2000, function() {
-
            if ($target.length) {
+
    location.hash = target;
-
                var targetOffset = $target.offset().left;
+
});
-
                $('html,body').animate({scrollLeft: targetOffset}, 1000);
+
-
                return false;
+
return false;
-
            }
+
  });
-
        }
+
-
    });
+
});
});
</script>
</script>

Revision as of 06:02, 29 August 2013