Permalink
Browse files

Switched to tabs for indentation

  • Loading branch information...
1 parent a610ca8 commit 9f6347d643188e159185b96e98a9a056b0dc399b @mathiasbynens committed Oct 16, 2010
Showing with 26 additions and 26 deletions.
  1. +26 −26 jquery.smoothscroll.js
View
@@ -1,29 +1,29 @@
/*!
- * Smooth Scrolling jQuery Plugin v1.4
- * @link http://github.com/mathiasbynens/Smooth-Scrolling-jQuery-Plugin
- * @author Mathias Bynens <http://mathiasbynens.be/>
- */
+* Smooth Scrolling jQuery Plugin v1.4
+* @link http://github.com/mathiasbynens/Smooth-Scrolling-jQuery-Plugin
+* @author Mathias Bynens <http://mathiasbynens.be/>
+*/
;(function($) {
- $.fn.smoothScroll = function(speed) {
- speed = ~~speed || 400;
- // Look for links to anchors (on any page)
- this.find('a[href*=#]').click(function(event) {
- var $scrollElement = $.browser.opera ? $('html') : $('html, body'),
- $hash = $(this.hash); // The in-document element the link points to
- // Don’t jump to the link right away
- event.preventDefault();
- // If it’s a link to an anchor in the same document
- if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
- // If the anchor actually exists…
- if ($hash.length) {
- // …smoothly scroll to it
- $scrollElement.stop().animate({ scrollTop: $hash.offset().top }, speed, function() {
- location.hash = $hash.attr('id');
- });
- }
- }
- });
- // Allow chaining
- return this;
- };
+ $.fn.smoothScroll = function(speed) {
+ speed = ~~speed || 400;
+ // Look for links to anchors (on any page)
+ this.find('a[href*=#]').click(function(event) {
+ var $scrollElement = $.browser.opera ? $('html') : $('html, body'),
+ $hash = $(this.hash); // The in-document element the link points to
+ // Don’t jump to the link right away
+ event.preventDefault();
+ // If it’s a link to an anchor in the same document
+ if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
+ // If the anchor actually exists…
+ if ($hash.length) {
+ // …smoothly scroll to it
+ $scrollElement.stop().animate({ scrollTop: $hash.offset().top }, speed, function() {
+ location.hash = $hash.attr('id');
+ });
+ }
+ }
+ });
+ // Allow chaining
+ return this;
+ };
})(jQuery);

0 comments on commit 9f6347d

Please sign in to comment.