diff options
author | Thomas Park <thomas@thomaspark.me> | 2013-03-15 16:43:43 -0400 |
---|---|---|
committer | Thomas Park <thomas@thomaspark.me> | 2013-03-15 16:43:43 -0400 |
commit | d3a35fcc0bd775ccaf4d1e5b67c044b9fc263e9f (patch) | |
tree | 90b6a5db8f310db1af810e59dbaa6964fdd02979 | |
parent | 9d916579caef67be7e0c3862647d51b0aef6961d (diff) |
all: fix smoothscroll in safari6 with jquery plugin
-rwxr-xr-x | amelia/index.html | 1 | ||||
-rwxr-xr-x | cerulean/index.html | 1 | ||||
-rwxr-xr-x | cosmo/index.html | 1 | ||||
-rwxr-xr-x | cyborg/index.html | 1 | ||||
-rwxr-xr-x | default/index.html | 1 | ||||
-rw-r--r-- | index.html | 1 | ||||
-rwxr-xr-x | journal/index.html | 1 | ||||
-rw-r--r-- | js/bootswatch.js | 53 | ||||
-rw-r--r-- | js/jquery.smooth-scroll.min.js | 7 | ||||
-rwxr-xr-x | readable/index.html | 1 | ||||
-rwxr-xr-x | shamrock/index.html | 1 | ||||
-rwxr-xr-x | simplex/index.html | 1 | ||||
-rwxr-xr-x | slate/index.html | 1 | ||||
-rwxr-xr-x | spacelab/index.html | 1 | ||||
-rwxr-xr-x | spruce/index.html | 1 | ||||
-rwxr-xr-x | superhero/index.html | 1 | ||||
-rwxr-xr-x | united/index.html | 1 |
17 files changed, 23 insertions, 52 deletions
diff --git a/amelia/index.html b/amelia/index.html index 7b56764c..e1de4ef1 100755 --- a/amelia/index.html +++ b/amelia/index.html @@ -902,6 +902,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/cerulean/index.html b/cerulean/index.html index 1b68cebc..1b82cd3f 100755 --- a/cerulean/index.html +++ b/cerulean/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/cosmo/index.html b/cosmo/index.html index 039ad603..0cb4c973 100755 --- a/cosmo/index.html +++ b/cosmo/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/cyborg/index.html b/cyborg/index.html index ca4e7c70..fa883190 100755 --- a/cyborg/index.html +++ b/cyborg/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/default/index.html b/default/index.html index 6bcf1353..b8ad0ac1 100755 --- a/default/index.html +++ b/default/index.html @@ -889,6 +889,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> @@ -588,6 +588,7 @@ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="js/jquery.smooth-scroll.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/bootswatch.js"></script> <script type="text/javascript"> diff --git a/journal/index.html b/journal/index.html index 45943287..2d962939 100755 --- a/journal/index.html +++ b/journal/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/js/bootswatch.js b/js/bootswatch.js index 71eba460..b0cee89e 100644 --- a/js/bootswatch.js +++ b/js/bootswatch.js @@ -1,61 +1,10 @@ -// tooltips - $('a[rel=tooltip]').tooltip({ 'placement': 'bottom' }); -// smooth scroll -$(document).ready(function() { - function filterPath(string) { - return string - .replace(/^\//,'') - .replace(/(index|default).[a-zA-Z]{3,4}$/,'') - .replace(/\/$/,''); - } - var locationPath = filterPath(location.pathname); - var scrollElem = scrollableElement('html', 'body'); - - $('a[href^=#]').each(function() { - var thisPath = filterPath(this.pathname) || locationPath; - if ( locationPath == thisPath - && (location.hostname == this.hostname || !this.hostname) - && this.hash.replace(/#/,'') ) { - var $target = $(this.hash), target = this.hash; - if (target) { - var targetOffset = $target.offset().top; - $(this).click(function(event) { - event.preventDefault(); - $(scrollElem).animate({scrollTop: targetOffset}, 400, function() { - location.hash = target; - }); - }); - } - } - }); - - // use the first element that is "scrollable" - function scrollableElement(els) { - for (var i = 0, argLength = arguments.length; i <argLength; i++) { - var el = arguments[i], - $scrollElement = $(el); - if ($scrollElement.scrollTop()> 0) { - return el; - } else { - $scrollElement.scrollTop(1); - var isScrollable = $scrollElement.scrollTop()> 0; - $scrollElement.scrollTop(0); - if (isScrollable) { - return el; - } - } - } - return []; - } - -}); +$('.subnav a').smoothScroll(); -// subnav (function ($) { diff --git a/js/jquery.smooth-scroll.min.js b/js/jquery.smooth-scroll.min.js new file mode 100644 index 00000000..2af596ee --- /dev/null +++ b/js/jquery.smooth-scroll.min.js @@ -0,0 +1,7 @@ +/*! + * Smooth Scroll - v1.4.10 - 2013-03-02 + * https://github.com/kswedberg/jquery-smooth-scroll + * Copyright (c) 2013 Karl Swedberg + * Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT) + */ +(function(l){function t(l){return l.replace(/(:|\.)/g,"\\$1")}var e="1.4.10",o={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2},r=function(t){var e=[],o=!1,r=t.dir&&"left"==t.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!=document&&this!=window){var t=l(this);t[r]()>0?e.push(this):(t[r](1),o=t[r]()>0,o&&e.push(this),t[r](0))}}),e.length||this.each(function(){"BODY"===this.nodeName&&(e=[this])}),"first"===t.el&&e.length>1&&(e=[e[0]]),e};l.fn.extend({scrollable:function(l){var t=r.call(this,{dir:l});return this.pushStack(t)},firstScrollable:function(l){var t=r.call(this,{el:"first",dir:l});return this.pushStack(t)},smoothScroll:function(e){e=e||{};var o=l.extend({},l.fn.smoothScroll.defaults,e),r=l.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(e){var n=this,s=l(this),c=o.exclude,i=o.excludeWithin,a=0,f=0,h=!0,u={},d=location.hostname===n.hostname||!n.hostname,m=o.scrollTarget||(l.smoothScroll.filterPath(n.pathname)||r)===r,p=t(n.hash);if(o.scrollTarget||d&&m&&p){for(;h&&c.length>a;)s.is(t(c[a++]))&&(h=!1);for(;h&&i.length>f;)s.closest(i[f++]).length&&(h=!1)}else h=!1;h&&(e.preventDefault(),l.extend(u,o,{scrollTarget:o.scrollTarget||p,link:n}),l.smoothScroll(u))}),this}}),l.smoothScroll=function(t,e){var o,r,n,s,c=0,i="offset",a="scrollTop",f={},h={};"number"==typeof t?(o=l.fn.smoothScroll.defaults,n=t):(o=l.extend({},l.fn.smoothScroll.defaults,t||{}),o.scrollElement&&(i="position","static"==o.scrollElement.css("position")&&o.scrollElement.css("position","relative"))),o=l.extend({link:null},o),a="left"==o.direction?"scrollLeft":a,o.scrollElement?(r=o.scrollElement,c=r[a]()):r=l("html, body").firstScrollable(),o.beforeScroll.call(r,o),n="number"==typeof t?t:e||l(o.scrollTarget)[i]()&&l(o.scrollTarget)[i]()[o.direction]||0,f[a]=n+c+o.offset,s=o.speed,"auto"===s&&(s=f[a]||r.scrollTop(),s/=o.autoCoefficent),h={duration:s,easing:o.easing,complete:function(){o.afterScroll.call(o.link,o)}},o.step&&(h.step=o.step),r.length?r.stop().animate(f,h):o.afterScroll.call(o.link,o)},l.smoothScroll.version=e,l.smoothScroll.filterPath=function(l){return l.replace(/^\//,"").replace(/(index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},l.fn.smoothScroll.defaults=o})(jQuery);
\ No newline at end of file diff --git a/readable/index.html b/readable/index.html index daa22d24..c72410e4 100755 --- a/readable/index.html +++ b/readable/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/shamrock/index.html b/shamrock/index.html index d52a4a08..6d7f7ff2 100755 --- a/shamrock/index.html +++ b/shamrock/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/simplex/index.html b/simplex/index.html index 866b2ade..aa31d2fe 100755 --- a/simplex/index.html +++ b/simplex/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/slate/index.html b/slate/index.html index cbc17c34..188fcd53 100755 --- a/slate/index.html +++ b/slate/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/spacelab/index.html b/spacelab/index.html index cce42068..da214ef6 100755 --- a/spacelab/index.html +++ b/spacelab/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/spruce/index.html b/spruce/index.html index 83a657c7..775bd8ee 100755 --- a/spruce/index.html +++ b/spruce/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/superhero/index.html b/superhero/index.html index 715f0230..baf91577 100755 --- a/superhero/index.html +++ b/superhero/index.html @@ -890,6 +890,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> diff --git a/united/index.html b/united/index.html index 5d726f95..22f4b59c 100755 --- a/united/index.html +++ b/united/index.html @@ -902,6 +902,7 @@ ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> + <script src="../js/jquery.smooth-scroll.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/bootswatch.js"></script> |