summaryrefslogtreecommitdiff
path: root/swatchmaker/test
diff options
context:
space:
mode:
authorThomas Park <thomas@thomaspark.me>2013-04-24 22:05:26 -0400
committerThomas Park <thomas@thomaspark.me>2013-04-24 22:05:26 -0400
commit2a062f7a34e6c499006bb8e5271f16f8241fa36f (patch)
tree731f5b50c3f6c0078eeac6d9be54096d0adf0280 /swatchmaker/test
parent787116eba4f81940df59cb9dc90b4e30b3c88484 (diff)
use jquery.smooth-scroll.js on swatchmaker
Diffstat (limited to 'swatchmaker/test')
-rw-r--r--swatchmaker/test/bootswatch.js53
-rw-r--r--swatchmaker/test/jquery.smooth-scroll.min.js7
-rwxr-xr-xswatchmaker/test/test-full.html1
-rwxr-xr-xswatchmaker/test/test.html3
4 files changed, 11 insertions, 53 deletions
diff --git a/swatchmaker/test/bootswatch.js b/swatchmaker/test/bootswatch.js
index 71eba460..5a9b3002 100644
--- a/swatchmaker/test/bootswatch.js
+++ b/swatchmaker/test/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 [];
- }
-
-});
+$('.navbar a, .subnav a').smoothScroll();
-// subnav
(function ($) {
diff --git a/swatchmaker/test/jquery.smooth-scroll.min.js b/swatchmaker/test/jquery.smooth-scroll.min.js
new file mode 100644
index 00000000..2af596ee
--- /dev/null
+++ b/swatchmaker/test/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/swatchmaker/test/test-full.html b/swatchmaker/test/test-full.html
index 333c74ca..9d1cdd2d 100755
--- a/swatchmaker/test/test-full.html
+++ b/swatchmaker/test/test-full.html
@@ -2458,6 +2458,7 @@
<script src="../bootstrap/docs/assets/js/bootstrap-carousel.js"></script>
<script src="../bootstrap/docs/assets/js/bootstrap-typeahead.js"></script>
<script src="../bootstrap/docs/assets/js/bootstrap-affix.js"></script>
+ <script src="jquery.smooth-scroll.min.js"></script>
<script src="bootswatch.js"></script>
<script>
diff --git a/swatchmaker/test/test.html b/swatchmaker/test/test.html
index 63b0b497..eaeee29e 100755
--- a/swatchmaker/test/test.html
+++ b/swatchmaker/test/test.html
@@ -696,7 +696,7 @@
<ul class="nav nav-tabs">
<li class="active"><a href="#A" data-toggle="tab">Section 1</a></li>
<li><a href="#B" data-toggle="tab">Section 2</a></li>
- <li><a href="#C" data-toggle="tab">Section 3</a></li>
+ <li class="disabled"><a href="#C" data-toggle="tab">Section 3</a></li>
</ul>
<div class="tabbable">
<div class="tab-content">
@@ -873,6 +873,7 @@
<script src="../bootstrap/docs/assets/js/bootstrap-carousel.js"></script>
<script src="../bootstrap/docs/assets/js/bootstrap-typeahead.js"></script>
<script src="../bootstrap/docs/assets/js/bootstrap-affix.js"></script>
+ <script src="jquery.smooth-scroll.min.js"></script>
<script src="bootswatch.js"></script>