diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..98da309 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "scripts/slick"] + path = scripts/slick + url = https://github.com/kenwheeler/slick +[submodule "scripts/smooth-scroll"] + path = scripts/smooth-scroll + url = https://github.com/cferdinandi/smooth-scroll diff --git a/index.html b/index.html index c662fa4..23c8e30 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ Citra - Experimental 3DS Emulator - + @@ -128,7 +128,7 @@ - + -``` - -#### Bower - -```` -bower install --save slick.js -```` - -#### Options - -Option | Type | Default | Description ------- | ---- | ------- | ----------- -accessibility | boolean | true | Enables tabbing and arrow key navigation -autoplay | boolean | false | Enables auto play of slides -autoplaySpeed | int | 3000 | Auto play change interval -centerMode | boolean | false | Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts. -centerPadding | string | '50px' | Side padding when in center mode. (px or %) -cssEase | string | 'ease' | CSS3 easing -customPaging | function | n/a | Custom paging templates. See source for use example. -dots | boolean | false | Current slide indicator dots -dotsClass | string | 'slick-dots' | Class for slide indicator dots container -draggable | boolean | true | Enables desktop dragging -easing | string | 'linear' | animate() fallback easing -fade | boolean | false | Enables fade -arrows | boolean | true | Enable Next/Prev arrows -appendArrows | string | $(element) | Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object) -appendDots | string | $(element) | Change where the navigation dots are attached (Selector, htmlString, Array, Element, jQuery object) -prevArrow | string (html|jQuery selector) | object (DOM node|jQuery object) | | Allows you to select a node or customize the HTML for the "Previous" arrow. -nextArrow | string (html|jQuery selector) | object (DOM node|jQuery object) | | Allows you to select a node or customize the HTML for the "Next" arrow. -infinite | boolean | true | Infinite looping -lazyLoad | string | 'ondemand' | Accepts 'ondemand' or 'progressive' for lazy load technique -onBeforeChange(this, currentIndex,targetIndex) | method | null | Before slide change callback -onAfterChange(this, index) | method | null | After slide change callback -onInit(this) | method | null | When Slick initializes for the first time callback -onReInit(this) | method | null | Every time Slick (re-)initializes callback -pauseOnHover | boolean | true | Pauses autoplay on hover -pauseOnDotsHover | boolean | false | Pauses autoplay when a dot is hovered -responsive | object | null | Breakpoint triggered settings -slide | string | 'div' | Slide element query -slidesToShow | int | 1 | # of slides to show at a time -slidesToScroll | int | 1 | # of slides to scroll at a time -speed | int | 300 | Transition speed -swipe | boolean | true | Enables touch swipe -swipeToSlide | boolean | false | Swipe to slide irrespective of slidesToScroll -touchMove | boolean | true | Enables slide moving with touch -touchThreshold | int | 5 | To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider. -useCSS | boolean | true | Enable/Disable CSS Transitions -variableWidth | boolean | false | Disables automatic slide width calculation -vertical | boolean | false | Vertical slide direction -rtl | boolean | false | Change the slider's direction to become right-to-left -waitForAnimate | boolean | true | Ignores requests to advance the slide while animating - - -#### Methods - -Method | Argument | Description ------- | -------- | ----------- -slick() | options : object | Initializes Slick -unslick() | | Destroys Slick -slickNext() | | Triggers next slide -slickPrev() | | Triggers previous slide -slickPause() | | Pause Autoplay -slickPlay() | | Start Autoplay -slickGoTo() | index : int | Goes to slide by index -slickCurrentSlide() | | Returns the current slide index -slickAdd() | element : html or DOM object, index: int, addBefore: bool | Add a slide. If an index is provided, will add at that index, or before if addBefore is set. If no index is provided, add to the end or to the beginning if addBefore is set. Accepts HTML String || Object -slideRemove() | index: int, removeBefore: bool | Remove slide by index. If removeBefore is set true, remove slide preceding index, or the first slide if no index is specified. If removeBefore is set to false, remove the slide following index, or the last slide if no index is set. -slickFilter() | filter : selector or function | Filters slides using jQuery .filter syntax -slickUnfilter() | | Removes applied filter -slickGetOption(option) | option : string(option name) | Gets an option value. -slickSetOption(option,value,refresh) | option : string(option name), value : depends on option, refresh : boolean | Sets an option live. Set refresh to true if it is an option that changes the display - - -#### Example - -Initialize with: - -```javascript -$(element).slick({ - dots: true, - speed: 500 -}); - ``` - -Destroy with: - -```javascript -$(element).unslick(); -``` - - -#### Sass Variables - -Variable | Type | Default | Description ------- | ---- | ------- | ----------- -$slick-font-path | string | "./fonts/" | Directory path for the slick icon font -$slick-font-family | string | "slick" | Font-family for slick icon font -$slick-loader-path | string | "./" | Directory path for the loader image -$slick-arrow-color | color | white | Color of the left/right arrow icons -$slick-dot-color | color | black | Color of the navigation dots -$slick-dot-color-active | color | $slick-dot-color | Color of the active navigation dot -$slick-prev-character | string | '\2190' | Unicode character code for the previous arrow icon -$slick-next-character | string | '\2192' | Unicode character code for the next arrow icon -$slick-dot-character | string | '\2022' | Unicode character code for the navigation dot icon -$slick-dot-size | pixels | 6px | Size of the navigation dots - - -#### Dependencies - -jQuery 1.7 - -#### License - -Copyright (c) 2014 Ken Wheeler - -Licensed under the MIT license. - -Free as in Bacon. diff --git a/scripts/slick-1.3.9/bower.json b/scripts/slick-1.3.9/bower.json deleted file mode 100755 index 448dff0..0000000 --- a/scripts/slick-1.3.9/bower.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "slick-carousel", - "main": ["slick/slick.min.js", "slick/slick.css"], - "version": "1.3.9", - "homepage": "https://github.com/kenwheeler/slick", - "authors": [ - "Ken Wheeler " - ], - "description": "the last carousel you'll ever need", - "keywords": [ - "responsive", - "carousel", - "jquery" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests", - "index.html" - ], - "dependencies": { - "jquery": ">=1.7" - } -} diff --git a/scripts/slick-1.3.9/component.json b/scripts/slick-1.3.9/component.json deleted file mode 100755 index 371dc02..0000000 --- a/scripts/slick-1.3.9/component.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "slick", - "repo": "kenwheeler/slick", - "description": "the last carousel you'll ever need", - "version": "1.3.9", - "keywords": ["ui", "jquery", "carousel", "responsive", "slider"], - "dependencies": { - "component/jquery": "*" - }, - "development": {}, - "scripts": { - "slick/slick.js": "slick.js" - }, - "styles": { - "slick/slick.css": "slick.css" - } -} \ No newline at end of file diff --git a/scripts/slick-1.3.9/css/pacifico.eot b/scripts/slick-1.3.9/css/pacifico.eot deleted file mode 100755 index 2cfe361..0000000 Binary files a/scripts/slick-1.3.9/css/pacifico.eot and /dev/null differ diff --git a/scripts/slick-1.3.9/css/pacifico.svg b/scripts/slick-1.3.9/css/pacifico.svg deleted file mode 100755 index 1c23b4b..0000000 --- a/scripts/slick-1.3.9/css/pacifico.svg +++ /dev/null @@ -1,1093 +0,0 @@ - - - - -Created by FontForge 20110222 at Wed Apr 9 04:06:13 2014 - By Orthosie Webhosting -Copyright (c) 2011 by vernon adams. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripts/slick-1.3.9/css/pacifico.ttf b/scripts/slick-1.3.9/css/pacifico.ttf deleted file mode 100755 index 01608e2..0000000 Binary files a/scripts/slick-1.3.9/css/pacifico.ttf and /dev/null differ diff --git a/scripts/slick-1.3.9/css/pacifico.woff b/scripts/slick-1.3.9/css/pacifico.woff deleted file mode 100755 index ddb25fc..0000000 Binary files a/scripts/slick-1.3.9/css/pacifico.woff and /dev/null differ diff --git a/scripts/slick-1.3.9/css/style.css b/scripts/slick-1.3.9/css/style.css deleted file mode 100755 index 140745a..0000000 --- a/scripts/slick-1.3.9/css/style.css +++ /dev/null @@ -1,92 +0,0 @@ -@font-face { - font-family: 'Pacifico'; - src: url('pacifico.eot'); - src: url('pacifico.eot?#iefix') format('embedded-opentype'), - url('pacifico.woff') format('woff'), - url('pacifico.ttf') format('truetype'), - url('pacifico.svg#Pacifico') format('svg'); -} - -#disqus_thread{margin-top:20px;} -*{-moz-box-sizing:border-box;box-sizing:border-box;} -.blue{background:#3498db;color:#fff;} -.blue h3{background:#fff;color:#3498db;font-size:36px;line-height:100px;margin:10px;padding:2%;position:relative;text-align:center;} -.button{background:#3498db;color:#fff;display:block;font-size:16px;margin:20px auto;padding:20px;text-align:center;text-decoration:none;width:48%;} -.buttons{padding:0 20px 20px; margin-bottom: 10px;} -.buttons .button{background:#FFF;color:#3498db;float:left;margin:5px;} -.center .slick-center h3{-moz-transform:scale(1.08);-ms-transform:scale(1.08);-o-transform:scale(1.08);-webkit-transform:scale(1.08);color:#e67e22;opacity:1;transform:scale(1.08);} -.center h3{opacity:0.8;transition:all 300ms ease;} -.content{margin:auto;padding:20px;width:600px;} -.content:after,.buttons::after{clear:both;content:"";display:table;} -.destroy{font-weight:400;margin-top:40px;} -.features{display:block;list-style-type:none;margin-top:30px;padding:0;text-align:center;} -.features li{margin:20px 0;} -.filter .button{background:#FFF;color:#3498db; margin-bottom: 40px;} -.fixed-header{background:#FFF;box-shadow:2px 0 5px rgba(0,0,0,0.5);display:none;padding:10px;position:fixed;top:0;width:100%;z-index:10000;} -.fixed-header .header-content{margin:auto;width:600px;} -.fixed-header .subheading{display:none;} -.fixed-header h1.title{float:left;font-size:24px;margin:0;} -.fixed-header ul.nav{float:right;margin:0;padding:5px;} -.fixed-header ul.nav li{margin:0 0 0 10px;} -.header{padding:20px 0;} -.margin-40{margin-bottom:40px;} -.more,.button.first{margin-top:40px;} -.red{background:#e74c3c;color:#fff;} -.slick-slide .image{padding:10px;} -.slick-slide img{border:5px solid #FFF;display:block;width:100%;} -.slick-slide img.slick-loading{border:0 } -.slick-slider{margin:30px auto 50px;} -.subheading{color:#555;font-size:12px;font-style:italic;font-weight:400;margin:10px auto;text-align:center;} -.white{background:#fff;color:#3498db;} -.white pre,.white hr{background:#3498db;} -a{color:#3498db;} -body,html{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;background:#fff;font-family:'Lucida Grande', sans-serif;height:100%;line-height:1;margin:0;padding:0;text-rendering:optimizeLegibility;width:100%;} -code{color:#000; overflow-x: scroll;} -h1{color:#3498db;font-family:Pacifico;font-size:72px;font-weight:400;line-height:1.2;margin:0 auto 10px;text-align:center;} -h1.title{font-size:96px;} -h2{font-family:Pacifico;font-size:36px;margin:20px auto;text-align:center;} -h4{font-family:Pacifico;font-size:28px;margin:20px auto;text-align:center;} -hr{background:#fff;border:0;height:1px;margin:40px 0;} -p{font-size:18px;font-weight:700;line-height:1.5;margin-bottom:40px;text-align:center;} -p.note{font-size: 12px;} -p.cdn{font-size: 14px;} -p.guff{font-size:16px;} -pre{background:#fff;margin:0 10px 20px;padding:10px;} -section{width:100%;} -table{font-size:14px;line-height:18px;margin:40px auto 20px; display: block; float: left;} -tr { width: 100%; border-right: none; border-bottom: 1px solid #fff; margin: 0px 0px 20px; padding: 0px 0px 20px; background: transparent; float: left; } -thead { display: none; } -td { border: 0; padding: 10px 0px;} -td,tbody { display: block; width: 100% !important;} -table.settings td:nth-of-type(1), table.methods td:nth-of-type(1){font-weight: bold; font-size: 16px; line-height: 18px;} -table.settings td:nth-of-type(2):before{content: 'Type: '; font-weight: bold;} -table.settings td:nth-of-type(3):before{content: 'Default: '; font-weight: bold;} -table.methods td:nth-of-type(2):before{content: 'Arguments: '; font-weight: bold;} -ul.nav{margin-bottom:0;padding-left:0;text-align:center;} -ul.nav li{display:inline-block;list-style-type:none;margin:0 20px;} -ul.nav li a{font-size:12px;text-decoration:none;} -@media (max-width: 420px) { -ul.nav li a{display:block;font-size:10px;} -} -@media (max-width: 768px) { -.blue h3{font-size:24px;} -.button{margin:0 auto 20px;width:auto;} -.button.first{margin-top:40px;} -.buttons{padding:0 0 20px;} -.buttons .button{float:left;font-size:12px;margin:1%;width:48%;} -.center{margin-left:-40px;margin-right:-40px;} -.center .slick-center h3{-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);-webkit-transform:scale(1);color:#e67e22;opacity:1;transform:scale(1);} -.center h3{-moz-transform:scale(0.95);-ms-transform:scale(0.95);-o-transform:scale(0.95);-webkit-transform:scale(0.95);opacity:0.8;transform:scale(0.95);transition:all 300ms ease;} -.content{margin:auto;padding:20px 40px;width:auto;} -.fixed-header .header-content{width:auto;} -pre{font-size:12px; overflow-x: scroll;} -table{font-size:14px;line-height:18px;margin:40px auto 20px; display: block; float: left;} -tr { width: 100%; border-right: none; border-bottom: 1px solid #fff; margin: 0px 0px 20px; padding: 0px 0px 20px; background: transparent; float: left; } -thead { display: none; } -td { border: 0; padding: 10px 0px;} -td,tbody { display: block; width: 100% !important;} -table.settings td:nth-of-type(1), table.methods td:nth-of-type(1){font-weight: bold; font-size: 16px; line-height: 18px;} -table.settings td:nth-of-type(2):before{content: 'Type: '; font-weight: bold;} -table.settings td:nth-of-type(3):before{content: 'Default: '; font-weight: bold;} -table.methods td:nth-of-type(2):before{content: 'Arguments: '; font-weight: bold;} -} \ No newline at end of file diff --git a/scripts/slick-1.3.9/img/fonz1.png b/scripts/slick-1.3.9/img/fonz1.png deleted file mode 100755 index ad847be..0000000 Binary files a/scripts/slick-1.3.9/img/fonz1.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/fonz2.png b/scripts/slick-1.3.9/img/fonz2.png deleted file mode 100755 index 9e64d59..0000000 Binary files a/scripts/slick-1.3.9/img/fonz2.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/fonz3.png b/scripts/slick-1.3.9/img/fonz3.png deleted file mode 100755 index 47e2526..0000000 Binary files a/scripts/slick-1.3.9/img/fonz3.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/lazyfonz1.png b/scripts/slick-1.3.9/img/lazyfonz1.png deleted file mode 100755 index 4bacf02..0000000 Binary files a/scripts/slick-1.3.9/img/lazyfonz1.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/lazyfonz2.png b/scripts/slick-1.3.9/img/lazyfonz2.png deleted file mode 100755 index 8f471fb..0000000 Binary files a/scripts/slick-1.3.9/img/lazyfonz2.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/lazyfonz3.png b/scripts/slick-1.3.9/img/lazyfonz3.png deleted file mode 100755 index 295d698..0000000 Binary files a/scripts/slick-1.3.9/img/lazyfonz3.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/lazyfonz4.png b/scripts/slick-1.3.9/img/lazyfonz4.png deleted file mode 100755 index 7282e60..0000000 Binary files a/scripts/slick-1.3.9/img/lazyfonz4.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/lazyfonz5.png b/scripts/slick-1.3.9/img/lazyfonz5.png deleted file mode 100755 index 8c9f5c8..0000000 Binary files a/scripts/slick-1.3.9/img/lazyfonz5.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/lazyfonz6.png b/scripts/slick-1.3.9/img/lazyfonz6.png deleted file mode 100755 index 9e3c23f..0000000 Binary files a/scripts/slick-1.3.9/img/lazyfonz6.png and /dev/null differ diff --git a/scripts/slick-1.3.9/img/slick.gif b/scripts/slick-1.3.9/img/slick.gif deleted file mode 100755 index 16b7672..0000000 Binary files a/scripts/slick-1.3.9/img/slick.gif and /dev/null differ diff --git a/scripts/slick-1.3.9/index.html b/scripts/slick-1.3.9/index.html deleted file mode 100755 index 6494c34..0000000 --- a/scripts/slick-1.3.9/index.html +++ /dev/null @@ -1,847 +0,0 @@ - - - - slick - the last carousel you'll ever need - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

slick

-

the last carousel you'll ever need

- -
-
- -
-
-

slick

-

the last carousel you'll ever need

- -
-
- -
-
-

Features

-
    -
  • Fully responsive. Scales with its container.
  • -
  • Separate settings per breakpoint
  • -
  • Uses CSS3 when available. Fully functional when not.
  • -
  • Swipe enabled. Or disabled, if you prefer.
  • -
  • Desktop mouse dragging
  • -
  • Infinite looping.
  • -
  • Fully accessible with arrow key navigation
  • -
  • Add, remove, filter & unfilter slides
  • -
  • Autoplay, dots, arrows, callbacks, etc...
  • -
-
-

Single Item

-
-

1

-

2

-

3

-

4

-

5

-

6

-
-

-$('.single-item').slick();
-				
-
-

Multiple Items

-
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-
-

-$('.multiple-items').slick({
-  infinite: true,
-  slidesToShow: 3,
-  slidesToScroll: 3
-});
-				
-
-

Responsive Display

-
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-
-

-$('.responsive').slick({
-  dots: true,
-  infinite: false,
-  speed: 300,
-  slidesToShow: 4,
-  slidesToScroll: 4,
-  responsive: [
-    {
-      breakpoint: 1024,
-      settings: {
-        slidesToShow: 3,
-        slidesToScroll: 3,
-        infinite: true,
-        dots: true
-      }
-    },
-    {
-      breakpoint: 600,
-      settings: {
-        slidesToShow: 2,
-        slidesToScroll: 2
-      }
-    },
-    {
-      breakpoint: 480,
-      settings: {
-        slidesToShow: 1,
-        slidesToScroll: 1
-      }
-    }
-  ]
-});
-				
-
-

Adaptive Height

-
-

1

-

2

Look ma!

-

3

Check
this out!

-

4

Woo!

-
-

-$('.one-time').slick({
-  dots: true,
-  infinite: true,
-  speed: 300,
-  slidesToShow: 1,
-  adaptiveHeight: true
-});
-				
-
-

Uneven Sets

-
-

1

-

2

-

3

-

4

-

5

-

6

-
-

-$('.uneven').slick({
-  slidesToShow: 4,
-  slidesToScroll: 4
-});
-				
-
-

Center Mode

-
-

1

-

2

-

3

-

4

-

5

-

6

-
-

-$('.center').slick({
-  centerMode: true,
-  centerPadding: '60px',
-  slidesToShow: 3,
-  responsive: [
-    {
-      breakpoint: 768,
-      settings: {
-        arrows: false,
-        centerMode: true,
-        centerPadding: '40px',
-        slidesToShow: 3
-      }
-    },
-    {
-      breakpoint: 480,
-      settings: {
-        arrows: false,
-        centerMode: true,
-        centerPadding: '40px',
-        slidesToShow: 1
-      }
-    }
-  ]
-});
-				
-
-

Lazy Loading

-
-
-
-
-
-
-
-
-

-// To use lazy loading, set a data-lazy attribute
-// on your img tags and leave off the src
-
-<img data-lazy="img/lazyfonz1.png"/>
-
-$('.lazy').slick({
-  lazyLoad: 'ondemand',
-  slidesToShow: 3,
-  slidesToScroll: 1
-});
-				
-
-

Autoplay

-
-

1

-

2

-

3

-

4

-

5

-

6

-
-

-$('.autoplay').slick({
-  slidesToShow: 3,
-  slidesToScroll: 1,
-  autoplay: true,
-  autoplaySpeed: 2000,
-});
-				
-
-

Fade

-
-
-
-
-
-

-$('.fade').slick({
-  dots: true,
-  infinite: true,
-  speed: 500,
-  fade: true,
-  slide: '> div',
-  cssEase: 'linear'
-});
-				
-
-

Add & Remove

-
-

1

-
- -

-$('.add-remove').slick({
-  slidesToShow: 3,
-  slidesToScroll: 3
-});
-var slideIndex = 1;
-$('.js-add-slide').on('click', function(){
-  slideIndex++;
-  $('.add-remove').slickAdd('<div><h3>'+slideIndex+'</h3></div>');
-});
-
-$('.js-remove-slide').on('click', function(){
-  $('.add-remove').slickRemove(slideIndex - 1);
-  if (slideIndex !== 0) {
-  	slideIndex--;
-  }
-});
-				
-
-

Filtering

-
-

1

-

2

-

3

-

4

-

5

-

6

-

7

-

8

-

9

-

10

-

11

-

12

-
- -

-$('.filtering').slick({
-  slidesToShow: 4,
-  slidesToScroll: 4
-});
-
-var filtered = false;
-
-$('.js-filter').on('click', function(){
-  if(filtered === false) {
-    $('.filtering').slickFilter(':even');
-    $(this).text('Unfilter Slides');
-    filtered = true;
-  } else {
-    $('.filtering').slickUnfilter();
-    $(this).text('Filter Slides');
-    filtered = false;
-  }
-});
-				
-
-

Destroy

-

If you really want to be that guy...

-

-$('.your-slider').unslick();
-				
-
-

Slider Syncing

-
-

1

-

2

-

3

-

4

-

5

-
-
-

1

-

2

-

3

-

4

-

5

-
-

- $('.slider-for').slick({
-    slidesToShow: 1,
-    slidesToScroll: 1,
-    arrows: false,
-    fade: true,
-    asNavFor: '.slider-nav'
-});
-$('.slider-nav').slick({
-    slidesToShow: 3,
-    slidesToScroll: 1,
-    asNavFor: '.slider-for',
-    dots: true,
-    centerMode: true,
-    focusOnSelect: true
-});
-				
-
-

Right to Left

-
-

1

-

2

-

3

-

4

-

5

-

6

-
-

-$('.single-item-rtl').slick({
-	rtl: true
-});
-				
- -

Note: the HTML tag or the parent of the slider must have the attribute "dir" set to "rtl".

-
-

and a whole lot more...

-
-
-
-
-

Getting Started

-

Set up your HTML markup.

-

-<div class="your-class">
-  <div>your content</div>
-  <div>your content</div>
-  <div>your content</div>
-</div>
-				
-
-

Move the /slick folder into your project

-
-

Add slick.css in your <head>

-

-<link rel="stylesheet" type="text/css" href="slick/slick.css"/>
-				
-
-

Add slick.js before your closing <body> tag, after jQuery (requires jQuery 1.7 +)

-

-<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
-<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
-<script type="text/javascript" src="slick/slick.min.js"></script>
-				
-
-

Initialize your slider in your script file or an inline script tag

-

-$(document).ready(function(){
-	$('.your-class').slick({
-	  setting-name: setting-value
-	});
-});
-				
-
-

When complete, your HTML should look something like:

-

-<html>
-    <head>
-    <title>My Now Amazing Webpage</title>
-    <link rel="stylesheet" type="text/css" href="slick/slick.css"/>
-    </head>
-    <body>
-
-    <div class="your-class">
-        <div>your content</div>
-        <div>your content</div>
-        <div>your content</div>
-    </div>
-
-    <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
-    <script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
-    <script type="text/javascript" src="slick/slick.min.js"></script>
-
-    <script type="text/javascript">
-        $(document).ready(function(){
-            $('.your-class').slick({
-                setting-name: setting-value
-            });
-        });
-    </script>
-
-    </body>
-</html>
-				
-

NOTE: I highly recommend putting your initialization script in an external JS file.

-
-
-
-
-

Settings

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SettingTypeDefaultDescription
accessibilitybooleantrueEnables tabbing and arrow key navigation
adaptiveHeightbooleanfalseEnables adaptive height for single slide horizontal carousels.
autoplaybooleanfalseEnables Autoplay
autoplaySpeedint(ms)3000Autoplay Speed in milliseconds
arrowsbooleantruePrev/Next Arrows
asNavForstringnullSet the slider to be the navigation of other slider (Class or ID Name)
appendArrowsstring$(element)Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object)
prevArrowstring (html|jQuery selector) | object (DOM node|jQuery object)<button type="button" class="slick-prev">Previous</button>Allows you to select a node or customize the HTML for the "Previous" arrow.
nextArrowstring (html|jQuery selector) | object (DOM node|jQuery object)<button type="button" class="slick-next">Next</button>Allows you to select a node or customize the HTML for the "Next" arrow.
centerModebooleanfalseEnables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts.
centerPaddingstring'50px'Side padding when in center mode (px or %)
cssEasestring'ease'CSS3 Animation Easing
customPagingfunctionn/aCustom paging templates. See source for use example.
dotsbooleanfalseShow dot indicators
draggablebooleantrueEnable mouse dragging
fadebooleanfalseEnable fade
focusOnSelectbooleanfalseEnable focus on selected element (click)
easingstring'linear'Add easing for jQuery animate. Use with easing libraries or default easing methods
infinitebooleantrueInfinite loop sliding
lazyLoadstring'ondemand'Set lazy loading technique. Accepts 'ondemand' or 'progressive'.
onBeforeChangefunctionnullBefore slide callback
onAfterChangefunctionnullAfter slide callback
onInitfunctionnullCallback that fires after first initialization
onReInitfunctionnullCallback that fires after every re-initialization
pauseOnHoverbooleantruePause Autoplay On Hover
pauseOnDotsHoverbooleanfalsePause Autoplay when a dot is hovered
responsiveobjectnoneObject containing breakpoints and settings objects (see demo). Enables settings sets at given screen width.
slideelement'div'Element query to use as slide
slidesToShowint1# of slides to show
slidesToScrollint1# of slides to scroll
speedint(ms)300Slide/Fade animation speed
swipebooleantrueEnable swiping
touchMovebooleantrueEnable slide motion with touch
touchThresholdint5To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider.
useCSSbooleantrueEnable/Disable CSS Transitions
verticalbooleanfalseVertical slide mode
rtlbooleanfalseChange the slider's direction to become right-to-left
-

Methods

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MethodArgumentsDescription
slickCurrentSlidenoneReturns the current slide index
slickGoToint : slide numberNavigates to a slide by index
slickNextnoneNavigates to the next slide
slickPrevnoneNavigates to the previous slide
slickPausenonePauses autoplay
slickPlaynoneStarts autoplay
slickAddhtml or DOM object, index, addBeforeAdd a slide. If an index is provided, will add at that index, or before if addBefore is set. If no index is provided, add to the end or to the beginning if addBefore is set. Accepts HTML String || Object
slickRemoveindex, removeBeforeRemove slide by index. If removeBefore is set true, remove slide preceding index, or the first slide if no index is specified. If removeBefore is set to false, remove the slide following index, or the last slide if no index is set.
slickFilterSelector or FunctionFilters slides using jQuery .filter()
slickUnfilterindexRemoves applied filtering
slickGetOptionoption : stringGets an individual option value.
slickSetOptionoption : string, value : depends on option, refresh : booleanSets an individual value live. Set refresh to true if it's a UI update.
unslicknoneDeconstructs slick
getSlicknoneGet Slick Object
-
-
- -
-
-

Go Get It

- Download Now - View On Github -
-

You can also use slick with the jsDelivr CDN!

-

-CSS
-
-<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.3.7/slick.css"/>
-
-JS
-
-<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.3.7/slick.min.js"></script>
-				
-
-

If you like slick, and also like Sass, try my Guff mixin library!

-
-
-
-
- - - - - - - - - - - - - diff --git a/scripts/slick-1.3.9/js/scripts.js b/scripts/slick-1.3.9/js/scripts.js deleted file mode 100755 index 82d862f..0000000 --- a/scripts/slick-1.3.9/js/scripts.js +++ /dev/null @@ -1,191 +0,0 @@ -$(document).ready(function() { - $('.single-item').slick({ - dots: true, - infinite: true, - speed: 300, - slidesToShow: 1, - slidesToScroll: 1 - }); - $('.multiple-items').slick({ - dots: true, - infinite: true, - speed: 300, - slidesToShow: 3, - slidesToScroll: 3 - }); - $('.one-time').slick({ - dots: true, - infinite: true, - speed: 300, - slidesToShow: 1, - adaptiveHeight: true - }); - $('.uneven').slick({ - dots: true, - infinite: true, - speed: 300, - slidesToShow: 4, - slidesToScroll: 4 - }); - $('.responsive').slick({ - dots: true, - infinite: false, - speed: 300, - slidesToShow: 4, - slidesToScroll: 4, - responsive: [{ - breakpoint: 1024, - settings: { - slidesToShow: 3, - slidesToScroll: 3, - infinite: true, - dots: true - } - }, { - breakpoint: 600, - settings: { - slidesToShow: 2, - slidesToScroll: 2 - } - }, { - breakpoint: 480, - settings: { - slidesToShow: 1, - slidesToScroll: 1 - } - }] - }); - - $('.center').slick({ - centerMode: true, - infinite: true, - centerPadding: '60px', - slidesToShow: 3, - responsive: [{ - breakpoint: 768, - settings: { - arrows: false, - centerMode: true, - centerPadding: '40px', - slidesToShow: 3 - } - }, { - breakpoint: 480, - settings: { - arrows: false, - centerMode: true, - centerPadding: '40px', - slidesToShow: 1 - } - }] - }); - $('.lazy').slick({ - lazyLoad: 'ondemand', - slidesToShow: 3, - slidesToScroll: 1 - }); - $('.autoplay').slick({ - dots: true, - infinite: true, - speed: 300, - slidesToShow: 3, - slidesToScroll: 1, - autoplay: true, - autoplaySpeed: 2000 - }); - - $('.fade').slick({ - dots: true, - infinite: true, - speed: 500, - fade: true, - slide: 'div', - cssEase: 'linear' - }); - - $('.add-remove').slick({ - dots: true, - slidesToShow: 3, - slidesToScroll: 3 - }); - var slideIndex = 1; - $('.js-add-slide').on('click', function() { - slideIndex++; - $('.add-remove').slickAdd('

' + slideIndex + '

'); - }); - - $('.js-remove-slide').on('click', function() { - $('.add-remove').slickRemove(slideIndex - 1); - if (slideIndex !== 0){ - slideIndex--; - } - }); - - $('.filtering').slick({ - dots: true, - slidesToShow: 4, - slidesToScroll: 4 - }); - var filtered = false; - $('.js-filter').on('click', function() { - if (filtered === false) { - $('.filtering').slickFilter(':even'); - $(this).text('Unfilter Slides'); - filtered = true; - } else { - $('.filtering').slickUnfilter(); - $(this).text('Filter Slides'); - filtered = false; - } - }); - - $('.slider-for').slick({ - slidesToShow: 1, - slidesToScroll: 1, - arrows: false, - fade: true, - asNavFor: '.slider-nav' - }); - $('.slider-nav').slick({ - slidesToShow: 3, - slidesToScroll: 1, - asNavFor: '.slider-for', - dots: true, - centerMode: true, - focusOnSelect: true - }); - - $(window).on('scroll', function() { - if ($(window).scrollTop() > 166) { - $('.fixed-header').show(); - } else { - $('.fixed-header').hide(); - } - }); - - $('ul.nav a').on('click', function(event) { - event.preventDefault(); - var targetID = $(this).attr('href'); - var targetST = $(targetID).offset().top - 48; - $('body, html').animate({ - scrollTop: targetST + 'px' - }, 300); - }); - - $('.single-item-rtl').slick({ - dots: true, - infinite: true, - speed: 300, - slidesToShow: 1, - slidesToScroll: 1, - rtl: true - }); - $('.multiple-items-rtl').slick({ - dots: true, - infinite: true, - slidesToShow: 3, - slidesToScroll: 3, - rtl: true - }); - -}); \ No newline at end of file diff --git a/scripts/slick-1.3.9/package.json b/scripts/slick-1.3.9/package.json deleted file mode 100755 index 044946f..0000000 --- a/scripts/slick-1.3.9/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "slick-carousel", - "version": "1.3.9", - "description": "the last carousel you'll ever need", - "main": "slick/slick.js", - "repository": { - "type": "git", - "url": "https://github.com/kenwheeler/slick.git" - }, - "keywords": [ - "carousel", - "slick", - "responsive" - ], - "author": "Ken Wheeler", - "license": "MIT", - "bugs": { - "url": "https://github.com/kenwheeler/slick/issues" - } -} \ No newline at end of file diff --git a/scripts/slick-1.3.9/slick.jquery.json b/scripts/slick-1.3.9/slick.jquery.json deleted file mode 100755 index 4f31fbe..0000000 --- a/scripts/slick-1.3.9/slick.jquery.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "slick", - "title": "slick", - "description": "A jQuery responsive touch carousel", - "keywords": [ - "responsive", - "slider", - "carousel", - "touch", - "mobile" - ], - "version": "1.3.9", - "author": { - "name": "Ken Wheeler", - "url": "http://kenwheeler.github.io" - }, - "maintainers": [{ - "name": "Ken Wheeler", - "email": "dubmediagroup@gmail.com", - "url": "http://www.dubmediagroup.com" - }], - "licenses": [{ - "type": "MIT", - "url": "https://github.com/kenwheeler/slick/blob/master/LICENSE" - }], - "demo": "http://kenwheeler.github.io/slick/", - "bugs": "https://github.com/kenwheeler/slick/issues", - "homepage": "https://github.com/kenwheeler/slick/", - "docs": "https://github.com/kenwheeler/slick/", - "download": "https://github.com/kenwheeler/slick/archive/master.zip", - "dependencies": { - "jquery": ">=1.7" - } -} \ No newline at end of file diff --git a/scripts/slick-1.3.9/slick/ajax-loader.gif b/scripts/slick-1.3.9/slick/ajax-loader.gif deleted file mode 100755 index e0e6e97..0000000 Binary files a/scripts/slick-1.3.9/slick/ajax-loader.gif and /dev/null differ diff --git a/scripts/slick-1.3.9/slick/config.rb b/scripts/slick-1.3.9/slick/config.rb deleted file mode 100755 index 81f5ae3..0000000 --- a/scripts/slick-1.3.9/slick/config.rb +++ /dev/null @@ -1,10 +0,0 @@ -css_dir = "." -sass_dir = "." -images_dir = "." -fonts_dir = "fonts" -relative_assets = true - -output_style = :compact -line_comments = false - -preferred_syntax = :scss \ No newline at end of file diff --git a/scripts/slick-1.3.9/slick/fonts/slick.eot b/scripts/slick-1.3.9/slick/fonts/slick.eot deleted file mode 100755 index 2cbab9c..0000000 Binary files a/scripts/slick-1.3.9/slick/fonts/slick.eot and /dev/null differ diff --git a/scripts/slick-1.3.9/slick/fonts/slick.svg b/scripts/slick-1.3.9/slick/fonts/slick.svg deleted file mode 100755 index b36a66a..0000000 --- a/scripts/slick-1.3.9/slick/fonts/slick.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - -Generated by Fontastic.me - - - - - - - - - - diff --git a/scripts/slick-1.3.9/slick/fonts/slick.ttf b/scripts/slick-1.3.9/slick/fonts/slick.ttf deleted file mode 100755 index 9d03461..0000000 Binary files a/scripts/slick-1.3.9/slick/fonts/slick.ttf and /dev/null differ diff --git a/scripts/slick-1.3.9/slick/fonts/slick.woff b/scripts/slick-1.3.9/slick/fonts/slick.woff deleted file mode 100755 index 8ee9972..0000000 Binary files a/scripts/slick-1.3.9/slick/fonts/slick.woff and /dev/null differ diff --git a/scripts/slick-1.3.9/slick/slick.css b/scripts/slick-1.3.9/slick/slick.css deleted file mode 100755 index e96cb21..0000000 --- a/scripts/slick-1.3.9/slick/slick.css +++ /dev/null @@ -1,55 +0,0 @@ -/* Slider */ -.slick-slider { position: relative; display: block; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -ms-touch-action: pan-y; touch-action: pan-y; -webkit-tap-highlight-color: transparent; } - -.slick-list { position: relative; overflow: hidden; display: block; margin: 0; padding: 0; } -.slick-list:focus { outline: none; } -.slick-loading .slick-list { background: white url("./ajax-loader.gif") center center no-repeat; } -.slick-list.dragging { cursor: pointer; cursor: hand; } - -.slick-slider .slick-list, .slick-track, .slick-slide, .slick-slide img { -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } - -.slick-track { position: relative; left: 0; top: 0; display: block; zoom: 1; } -.slick-track:before, .slick-track:after { content: ""; display: table; } -.slick-track:after { clear: both; } -.slick-loading .slick-track { visibility: hidden; } - -.slick-slide { float: left; height: 100%; min-height: 1px; display: none; } -.slick-slide img { display: block; } -.slick-slide.slick-loading img { display: none; } -.slick-slide.dragging img { pointer-events: none; } -.slick-initialized .slick-slide { display: block; } -.slick-loading .slick-slide { visibility: hidden; } -.slick-vertical .slick-slide { display: block; height: auto; border: 1px solid transparent; } - -/* Icons */ -@font-face { font-family: "slick"; src: url("./fonts/slick.eot"); src: url("./fonts/slick.eot?#iefix") format("embedded-opentype"), url("./fonts/slick.woff") format("woff"), url("./fonts/slick.ttf") format("truetype"), url("./fonts/slick.svg#slick") format("svg"); font-weight: normal; font-style: normal; } -/* Arrows */ -.slick-prev, .slick-next { position: absolute; display: block; height: 20px; width: 20px; line-height: 0; font-size: 0; cursor: pointer; background: transparent; color: transparent; top: 50%; margin-top: -10px; padding: 0; border: none; outline: none; } -.slick-prev:hover, .slick-prev:focus, .slick-next:hover, .slick-next:focus { outline: none; background: transparent; color: transparent; } -.slick-prev:hover:before, .slick-prev:focus:before, .slick-next:hover:before, .slick-next:focus:before { opacity: 1; } -.slick-prev.slick-disabled:before, .slick-next.slick-disabled:before { opacity: 0.25; } - -.slick-prev:before, .slick-next:before { font-family: "slick"; font-size: 20px; line-height: 1; color: white; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } - -.slick-prev { left: -25px; } -.slick-prev:before { content: "\2190"; } - -.slick-next { right: -25px; } -.slick-next:before { content: "\2192"; } - -/* Dots */ -.slick-slider { margin-bottom: 30px; } - -.slick-dots { position: absolute; bottom: -45px; list-style: none; display: block; text-align: center; padding: 0; width: 100%; } -.slick-dots li { position: relative; display: inline-block; height: 20px; width: 20px; margin: 0 5px; padding: 0; cursor: pointer; } -.slick-dots li button { border: 0; background: transparent; display: block; height: 20px; width: 20px; outline: none; line-height: 0; font-size: 0; color: transparent; padding: 5px; cursor: pointer; } -.slick-dots li button:hover, .slick-dots li button:focus { outline: none; } -.slick-dots li button:hover:before, .slick-dots li button:focus:before { opacity: 1; } -.slick-dots li button:before { position: absolute; top: 0; left: 0; content: "\2022"; width: 20px; height: 20px; font-family: "slick"; font-size: 6px; line-height: 20px; text-align: center; color: black; opacity: 0.25; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } -.slick-dots li.slick-active button:before { color: black; opacity: 0.75; } - -[dir="rtl"] .slick-next {right: auto;left: -25px;} -[dir="rtl"] .slick-next:before {content: "\2190";} -[dir="rtl"] .slick-prev {right: -25px;left: auto;} -[dir="rtl"] .slick-prev:before {content: "\2192";} -[dir="rtl"] .slick-slide {float: right;} \ No newline at end of file diff --git a/scripts/slick-1.3.9/slick/slick.js b/scripts/slick-1.3.9/slick/slick.js deleted file mode 100755 index 48ecf06..0000000 --- a/scripts/slick-1.3.9/slick/slick.js +++ /dev/null @@ -1,1927 +0,0 @@ -/* - _ _ _ _ - ___| (_) ___| | __ (_)___ -/ __| | |/ __| |/ / | / __| -\__ \ | | (__| < _ | \__ \ -|___/_|_|\___|_|\_(_)/ |___/ - |__/ - - Version: 1.3.9 - Author: Ken Wheeler - Website: http://kenwheeler.github.io - Docs: http://kenwheeler.github.io/slick - Repo: http://github.com/kenwheeler/slick - Issues: http://github.com/kenwheeler/slick/issues - - */ - -/* global window, document, define, jQuery, setInterval, clearInterval */ - -(function(factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } else if (typeof exports !== 'undefined') { - module.exports = factory(require('jquery')); - } else { - factory(jQuery); - } - -}(function($) { - 'use strict'; - var Slick = window.Slick || {}; - - Slick = (function() { - - var instanceUid = 0; - - function Slick(element, settings) { - - var _ = this, - responsiveSettings, breakpoint; - - _.defaults = { - accessibility: true, - adaptiveHeight: false, - appendArrows: $(element), - appendDots: $(element), - arrows: true, - asNavFor: null, - prevArrow: '', - nextArrow: '', - autoplay: false, - autoplaySpeed: 3000, - centerMode: false, - centerPadding: '50px', - cssEase: 'ease', - customPaging: function(slider, i) { - return ''; - }, - dots: false, - dotsClass: 'slick-dots', - draggable: true, - easing: 'linear', - fade: false, - focusOnSelect: false, - infinite: true, - lazyLoad: 'ondemand', - onBeforeChange: null, - onAfterChange: null, - onInit: null, - onReInit: null, - pauseOnHover: true, - pauseOnDotsHover: false, - responsive: null, - rtl: false, - slide: 'div', - slidesToShow: 1, - slidesToScroll: 1, - speed: 300, - swipe: true, - swipeToSlide: false, - touchMove: true, - touchThreshold: 5, - useCSS: true, - variableWidth: false, - vertical: false, - waitForAnimate: true - }; - - _.initials = { - animating: false, - dragging: false, - autoPlayTimer: null, - currentSlide: 0, - currentLeft: null, - direction: 1, - $dots: null, - listWidth: null, - listHeight: null, - loadIndex: 0, - $nextArrow: null, - $prevArrow: null, - slideCount: null, - slideWidth: null, - $slideTrack: null, - $slides: null, - sliding: false, - slideOffset: 0, - swipeLeft: null, - $list: null, - touchObject: {}, - transformsEnabled: false - }; - - $.extend(_, _.initials); - - _.activeBreakpoint = null; - _.animType = null; - _.animProp = null; - _.breakpoints = []; - _.breakpointSettings = []; - _.cssTransitions = false; - _.paused = false; - _.positionProp = null; - _.$slider = $(element); - _.$slidesCache = null; - _.transformType = null; - _.transitionType = null; - _.windowWidth = 0; - _.windowTimer = null; - - _.options = $.extend({}, _.defaults, settings); - - _.originalSettings = _.options; - responsiveSettings = _.options.responsive || null; - - if (responsiveSettings && responsiveSettings.length > -1) { - for (breakpoint in responsiveSettings) { - if (responsiveSettings.hasOwnProperty(breakpoint)) { - _.breakpoints.push(responsiveSettings[ - breakpoint].breakpoint); - _.breakpointSettings[responsiveSettings[ - breakpoint].breakpoint] = - responsiveSettings[breakpoint].settings; - } - } - _.breakpoints.sort(function(a, b) { - return b - a; - }); - } - - _.autoPlay = $.proxy(_.autoPlay, _); - _.autoPlayClear = $.proxy(_.autoPlayClear, _); - _.changeSlide = $.proxy(_.changeSlide, _); - _.selectHandler = $.proxy(_.selectHandler, _); - _.setPosition = $.proxy(_.setPosition, _); - _.swipeHandler = $.proxy(_.swipeHandler, _); - _.dragHandler = $.proxy(_.dragHandler, _); - _.keyHandler = $.proxy(_.keyHandler, _); - _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); - - _.instanceUid = instanceUid++; - - // A simple way to check for HTML strings - // Strict HTML recognition (must start with <) - // Extracted from jQuery v1.11 source - _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; - - _.init(); - - } - - return Slick; - - }()); - - Slick.prototype.addSlide = function(markup, index, addBefore) { - - var _ = this; - - if (typeof(index) === 'boolean') { - addBefore = index; - index = null; - } else if (index < 0 || (index >= _.slideCount)) { - return false; - } - - _.unload(); - - if (typeof(index) === 'number') { - if (index === 0 && _.$slides.length === 0) { - $(markup).appendTo(_.$slideTrack); - } else if (addBefore) { - $(markup).insertBefore(_.$slides.eq(index)); - } else { - $(markup).insertAfter(_.$slides.eq(index)); - } - } else { - if (addBefore === true) { - $(markup).prependTo(_.$slideTrack); - } else { - $(markup).appendTo(_.$slideTrack); - } - } - - _.$slides = _.$slideTrack.children(this.options.slide); - - _.$slideTrack.children(this.options.slide).detach(); - - _.$slideTrack.append(_.$slides); - - _.$slides.each(function(index, element) { - $(element).attr("index",index); - }); - - _.$slidesCache = _.$slides; - - _.reinit(); - - }; - - Slick.prototype.animateSlide = function(targetLeft, callback) { - - var animProps = {}, _ = this; - - if(_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { - var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); - _.$list.animate({height: targetHeight},_.options.speed); - } - - if (_.options.rtl === true && _.options.vertical === false) { - targetLeft = -targetLeft; - } - if (_.transformsEnabled === false) { - if (_.options.vertical === false) { - _.$slideTrack.animate({ - left: targetLeft - }, _.options.speed, _.options.easing, callback); - } else { - _.$slideTrack.animate({ - top: targetLeft - }, _.options.speed, _.options.easing, callback); - } - - } else { - - if (_.cssTransitions === false) { - - $({ - animStart: _.currentLeft - }).animate({ - animStart: targetLeft - }, { - duration: _.options.speed, - easing: _.options.easing, - step: function(now) { - if (_.options.vertical === false) { - animProps[_.animType] = 'translate(' + - now + 'px, 0px)'; - _.$slideTrack.css(animProps); - } else { - animProps[_.animType] = 'translate(0px,' + - now + 'px)'; - _.$slideTrack.css(animProps); - } - }, - complete: function() { - if (callback) { - callback.call(); - } - } - }); - - } else { - - _.applyTransition(); - - if (_.options.vertical === false) { - animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; - } else { - animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; - } - _.$slideTrack.css(animProps); - - if (callback) { - setTimeout(function() { - - _.disableTransition(); - - callback.call(); - }, _.options.speed); - } - - } - - } - - }; - - Slick.prototype.asNavFor = function(index) { - var _ = this, asNavFor = _.options.asNavFor != null ? $(_.options.asNavFor).getSlick() : null; - if(asNavFor != null) asNavFor.slideHandler(index, true); - }; - - Slick.prototype.applyTransition = function(slide) { - - var _ = this, - transition = {}; - - if (_.options.fade === false) { - transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; - } else { - transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; - } - - if (_.options.fade === false) { - _.$slideTrack.css(transition); - } else { - _.$slides.eq(slide).css(transition); - } - - }; - - Slick.prototype.autoPlay = function() { - - var _ = this; - - if (_.autoPlayTimer) { - clearInterval(_.autoPlayTimer); - } - - if (_.slideCount > _.options.slidesToShow && _.paused !== true) { - _.autoPlayTimer = setInterval(_.autoPlayIterator, - _.options.autoplaySpeed); - } - - }; - - Slick.prototype.autoPlayClear = function() { - - var _ = this; - - if (_.autoPlayTimer) { - clearInterval(_.autoPlayTimer); - } - - }; - - Slick.prototype.autoPlayIterator = function() { - - var _ = this; - - if (_.options.infinite === false) { - - if (_.direction === 1) { - - if ((_.currentSlide + 1) === _.slideCount - - 1) { - _.direction = 0; - } - - _.slideHandler(_.currentSlide + _.options.slidesToScroll); - - } else { - - if ((_.currentSlide - 1 === 0)) { - - _.direction = 1; - - } - - _.slideHandler(_.currentSlide - _.options.slidesToScroll); - - } - - } else { - - _.slideHandler(_.currentSlide + _.options.slidesToScroll); - - } - - }; - - Slick.prototype.buildArrows = function() { - - var _ = this; - - if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { - - _.$prevArrow = $(_.options.prevArrow); - _.$nextArrow = $(_.options.nextArrow); - - if (_.htmlExpr.test(_.options.prevArrow)) { - _.$prevArrow.appendTo(_.options.appendArrows); - } - - if (_.htmlExpr.test(_.options.nextArrow)) { - _.$nextArrow.appendTo(_.options.appendArrows); - } - - if (_.options.infinite !== true) { - _.$prevArrow.addClass('slick-disabled'); - } - - } - - }; - - Slick.prototype.buildDots = function() { - - var _ = this, - i, dotString; - - if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { - - dotString = ''; - - _.$dots = $(dotString).appendTo( - _.options.appendDots); - - _.$dots.find('li').first().addClass( - 'slick-active'); - - } - - }; - - Slick.prototype.buildOut = function() { - - var _ = this; - - _.$slides = _.$slider.children(_.options.slide + - ':not(.slick-cloned)').addClass( - 'slick-slide'); - _.slideCount = _.$slides.length; - - _.$slides.each(function(index, element) { - $(element).attr("index",index); - }); - - _.$slidesCache = _.$slides; - - _.$slider.addClass('slick-slider'); - - _.$slideTrack = (_.slideCount === 0) ? - $('
').appendTo(_.$slider) : - _.$slides.wrapAll('
').parent(); - - _.$list = _.$slideTrack.wrap( - '
').parent(); - _.$slideTrack.css('opacity', 0); - - if (_.options.centerMode === true) { - _.options.slidesToScroll = 1; - if (_.options.slidesToShow % 2 === 0) { - _.options.slidesToShow = 3; - } - } - - $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); - - _.setupInfinite(); - - _.buildArrows(); - - _.buildDots(); - - _.updateDots(); - - if (_.options.accessibility === true) { - _.$list.prop('tabIndex', 0); - } - - _.setSlideClasses(typeof this.currentSlide === 'number' ? this.currentSlide : 0); - - if (_.options.draggable === true) { - _.$list.addClass('draggable'); - } - - }; - - Slick.prototype.checkResponsive = function() { - - var _ = this, - breakpoint, targetBreakpoint; - - if (_.originalSettings.responsive && _.originalSettings - .responsive.length > -1 && _.originalSettings.responsive !== null) { - - targetBreakpoint = null; - - for (breakpoint in _.breakpoints) { - if (_.breakpoints.hasOwnProperty(breakpoint)) { - if ($(window).width() < _.breakpoints[ - breakpoint]) { - targetBreakpoint = _.breakpoints[ - breakpoint]; - } - } - } - - if (targetBreakpoint !== null) { - if (_.activeBreakpoint !== null) { - if (targetBreakpoint !== _.activeBreakpoint) { - _.activeBreakpoint = - targetBreakpoint; - _.options = $.extend({}, _.options, - _.breakpointSettings[ - targetBreakpoint]); - _.refresh(); - } - } else { - _.activeBreakpoint = targetBreakpoint; - _.options = $.extend({}, _.options, - _.breakpointSettings[ - targetBreakpoint]); - _.refresh(); - } - } else { - if (_.activeBreakpoint !== null) { - _.activeBreakpoint = null; - _.options = $.extend({}, _.options, - _.originalSettings); - _.refresh(); - } - } - - } - - }; - - Slick.prototype.changeSlide = function(event) { - - var _ = this, - $target = $(event.target), - indexOffset, slideOffset, unevenOffset; - - // If target is a link, prevent default action. - $target.is('a') && event.preventDefault(); - - unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); - indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; - - switch (event.data.message) { - - case 'previous': - slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; - if (_.slideCount > _.options.slidesToShow) { - _.slideHandler(_.currentSlide - slideOffset); - } - break; - - case 'next': - slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; - if (_.slideCount > _.options.slidesToShow) { - _.slideHandler(_.currentSlide + slideOffset); - } - break; - - case 'index': - var index = event.data.index === 0 ? 0 : - event.data.index || $(event.target).parent().index() * _.options.slidesToScroll; - _.slideHandler(index); - - default: - return false; - } - - }; - - Slick.prototype.destroy = function() { - - var _ = this; - - _.autoPlayClear(); - - _.touchObject = {}; - - $('.slick-cloned', _.$slider).remove(); - if (_.$dots) { - _.$dots.remove(); - } - if (_.$prevArrow) { - _.$prevArrow.remove(); - _.$nextArrow.remove(); - } - if (_.$slides.parent().hasClass('slick-track')) { - _.$slides.unwrap().unwrap(); - } - _.$slides.removeClass( - 'slick-slide slick-active slick-visible').css('width', ''); - _.$slider.removeClass('slick-slider'); - _.$slider.removeClass('slick-initialized'); - - _.$list.off('.slick'); - $(window).off('.slick-' + _.instanceUid); - $(document).off('.slick-' + _.instanceUid); - - }; - - Slick.prototype.disableTransition = function(slide) { - - var _ = this, - transition = {}; - - transition[_.transitionType] = ""; - - if (_.options.fade === false) { - _.$slideTrack.css(transition); - } else { - _.$slides.eq(slide).css(transition); - } - - }; - - Slick.prototype.fadeSlide = function(slideIndex, callback) { - - var _ = this; - - if (_.cssTransitions === false) { - - _.$slides.eq(slideIndex).css({ - zIndex: 1000 - }); - - _.$slides.eq(slideIndex).animate({ - opacity: 1 - }, _.options.speed, _.options.easing, callback); - - } else { - - _.applyTransition(slideIndex); - - _.$slides.eq(slideIndex).css({ - opacity: 1, - zIndex: 1000 - }); - - if (callback) { - setTimeout(function() { - - _.disableTransition(slideIndex); - - callback.call(); - }, _.options.speed); - } - - } - - }; - - Slick.prototype.filterSlides = function(filter) { - - var _ = this; - - if (filter !== null) { - - _.unload(); - - _.$slideTrack.children(this.options.slide).detach(); - - _.$slidesCache.filter(filter).appendTo(_.$slideTrack); - - _.reinit(); - - } - - }; - - Slick.prototype.getCurrent = function() { - - var _ = this; - - return _.currentSlide; - - }; - - Slick.prototype.getDotCount = function() { - - var _ = this, - breaker = 0, - dotCounter = 0, - dotCount = 0, - dotLimit; - - dotLimit = _.options.infinite === true ? _.slideCount + _.options.slidesToShow - _.options.slidesToScroll : _.slideCount; - - while (breaker < dotLimit) { - dotCount++; - dotCounter += _.options.slidesToScroll; - breaker = dotCounter + _.options.slidesToShow; - } - - return dotCount; - - }; - - Slick.prototype.getLeft = function(slideIndex) { - - var _ = this, - targetLeft, - verticalHeight, - verticalOffset = 0, - slideWidth, - targetSlide; - - _.slideOffset = 0; - verticalHeight = _.$slides.first().outerHeight(); - - if (_.options.infinite === true) { - if (_.slideCount > _.options.slidesToShow) { - _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; - verticalOffset = (verticalHeight * _.options.slidesToShow) * -1; - } - if (_.slideCount % _.options.slidesToScroll !== 0) { - if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { - _.slideOffset = ((_.slideCount % _.options.slidesToShow) * _.slideWidth) * -1; - verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight) * -1; - } - } - } else { - if (_.slideCount % _.options.slidesToShow !== 0) { - if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { - _.slideOffset = (_.options.slidesToShow * _.slideWidth) - ((_.slideCount % _.options.slidesToShow) * _.slideWidth); - verticalOffset = ((_.slideCount % _.options.slidesToShow) * verticalHeight); - } - } - } - - if (_.slideCount <= _.options.slidesToShow){ - _.slideOffset = 0; - verticalOffset = 0; - } - - if (_.options.centerMode === true && _.options.infinite === true) { - _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; - } else if (_.options.centerMode === true) { - _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); - } - - if (_.options.vertical === false) { - targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; - } else { - targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; - } - - if (_.options.variableWidth === true) { - - if(_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { - targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); - } else { - targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); - } - targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; - if (_.options.centerMode === true) { - targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); - targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; - targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; - } - } - - return targetLeft; - - }; - - Slick.prototype.init = function() { - - var _ = this; - - if (!$(_.$slider).hasClass('slick-initialized')) { - - $(_.$slider).addClass('slick-initialized'); - _.buildOut(); - _.setProps(); - _.startLoad(); - _.loadSlider(); - _.initializeEvents(); - _.checkResponsive(); - } - - if (_.options.onInit !== null) { - _.options.onInit.call(this, _); - } - - }; - - Slick.prototype.initArrowEvents = function() { - - var _ = this; - - if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { - _.$prevArrow.on('click.slick', { - message: 'previous' - }, _.changeSlide); - _.$nextArrow.on('click.slick', { - message: 'next' - }, _.changeSlide); - } - - }; - - Slick.prototype.initDotEvents = function() { - - var _ = this; - - if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { - $('li', _.$dots).on('click.slick', { - message: 'index' - }, _.changeSlide); - } - - if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) { - $('li', _.$dots) - .on('mouseenter.slick', _.autoPlayClear) - .on('mouseleave.slick', _.autoPlay); - } - - }; - - Slick.prototype.initializeEvents = function() { - - var _ = this; - - _.initArrowEvents(); - - _.initDotEvents(); - - _.$list.on('touchstart.slick mousedown.slick', { - action: 'start' - }, _.swipeHandler); - _.$list.on('touchmove.slick mousemove.slick', { - action: 'move' - }, _.swipeHandler); - _.$list.on('touchend.slick mouseup.slick', { - action: 'end' - }, _.swipeHandler); - _.$list.on('touchcancel.slick mouseleave.slick', { - action: 'end' - }, _.swipeHandler); - - if (_.options.pauseOnHover === true && _.options.autoplay === true) { - _.$list.on('mouseenter.slick', _.autoPlayClear); - _.$list.on('mouseleave.slick', _.autoPlay); - } - - if(_.options.accessibility === true) { - _.$list.on('keydown.slick', _.keyHandler); - } - - if(_.options.focusOnSelect === true) { - $(_.options.slide, _.$slideTrack).on('click.slick', _.selectHandler); - } - - $(window).on('orientationchange.slick.slick-' + _.instanceUid, function() { - _.checkResponsive(); - _.setPosition(); - }); - - $(window).on('resize.slick.slick-' + _.instanceUid, function() { - if ($(window).width() !== _.windowWidth) { - clearTimeout(_.windowDelay); - _.windowDelay = window.setTimeout(function() { - _.windowWidth = $(window).width(); - _.checkResponsive(); - _.setPosition(); - }, 50); - } - }); - - $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); - $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition); - - }; - - Slick.prototype.initUI = function() { - - var _ = this; - - if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { - - _.$prevArrow.show(); - _.$nextArrow.show(); - - } - - if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { - - _.$dots.show(); - - } - - if (_.options.autoplay === true) { - - _.autoPlay(); - - } - - }; - - Slick.prototype.keyHandler = function(event) { - - var _ = this; - - if (event.keyCode === 37) { - _.changeSlide({ - data: { - message: 'previous' - } - }); - } else if (event.keyCode === 39) { - _.changeSlide({ - data: { - message: 'next' - } - }); - } - - }; - - Slick.prototype.lazyLoad = function() { - - var _ = this, - loadRange, cloneRange, rangeStart, rangeEnd; - - function loadImages(imagesScope) { - $('img[data-lazy]', imagesScope).each(function() { - var image = $(this), - imageSource = $(this).attr('data-lazy'); - - image - .load(function() { image.animate({ opacity: 1 }, 200); }) - .css({ opacity: 0 }) - .attr('src', imageSource) - .removeAttr('data-lazy') - .removeClass('slick-loading'); - }); - } - - if (_.options.centerMode === true) { - if (_.options.infinite === true) { - rangeStart = _.currentSlide + (_.options.slidesToShow/2 + 1); - rangeEnd = rangeStart + _.options.slidesToShow + 2; - } else { - rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow/2 + 1)); - rangeEnd = 2 + (_.options.slidesToShow/2 + 1) + _.currentSlide; - } - } else { - rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; - rangeEnd = rangeStart + _.options.slidesToShow; - if (_.options.fade === true ) { - if(rangeStart > 0) rangeStart--; - if(rangeEnd <= _.slideCount) rangeEnd++; - } - } - - loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); - loadImages(loadRange); - - if (_.slideCount <= _.options.slidesToShow){ - cloneRange = _.$slider.find('.slick-slide') - loadImages(cloneRange) - }else - if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { - cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); - loadImages(cloneRange) - } else if (_.currentSlide === 0) { - cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); - loadImages(cloneRange); - } - - }; - - Slick.prototype.loadSlider = function() { - - var _ = this; - - _.setPosition(); - - _.$slideTrack.css({ - opacity: 1 - }); - - _.$slider.removeClass('slick-loading'); - - _.initUI(); - - if (_.options.lazyLoad === 'progressive') { - _.progressiveLazyLoad(); - } - - }; - - Slick.prototype.postSlide = function(index) { - - var _ = this; - - if (_.options.onAfterChange !== null) { - _.options.onAfterChange.call(this, _, index); - } - - _.animating = false; - - _.setPosition(); - - _.swipeLeft = null; - - if (_.options.autoplay === true && _.paused === false) { - _.autoPlay(); - } - - }; - - Slick.prototype.progressiveLazyLoad = function() { - - var _ = this, - imgCount, targetImage; - - imgCount = $('img[data-lazy]').length; - - if (imgCount > 0) { - targetImage = $('img[data-lazy]', _.$slider).first(); - targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function() { - targetImage.removeAttr('data-lazy'); - _.progressiveLazyLoad(); - }) - .error(function () { - targetImage.removeAttr('data-lazy'); - _.progressiveLazyLoad(); - }); - } - - }; - - Slick.prototype.refresh = function() { - - var _ = this, - currentSlide = _.currentSlide; - - _.destroy(); - - $.extend(_, _.initials); - - _.currentSlide = currentSlide; - _.init(); - - }; - - Slick.prototype.reinit = function() { - - var _ = this; - - _.$slides = _.$slideTrack.children(_.options.slide).addClass( - 'slick-slide'); - - _.slideCount = _.$slides.length; - - if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { - _.currentSlide = _.currentSlide - _.options.slidesToScroll; - } - - if (_.slideCount <= _.options.slidesToShow) { - _.currentSlide = 0; - } - - _.setProps(); - - _.setupInfinite(); - - _.buildArrows(); - - _.updateArrows(); - - _.initArrowEvents(); - - _.buildDots(); - - _.updateDots(); - - _.initDotEvents(); - - if(_.options.focusOnSelect === true) { - $(_.options.slide, _.$slideTrack).on('click.slick', _.selectHandler); - } - - _.setSlideClasses(0); - - _.setPosition(); - - if (_.options.onReInit !== null) { - _.options.onReInit.call(this, _); - } - - }; - - Slick.prototype.removeSlide = function(index, removeBefore) { - - var _ = this; - - if (typeof(index) === 'boolean') { - removeBefore = index; - index = removeBefore === true ? 0 : _.slideCount - 1; - } else { - index = removeBefore === true ? --index : index; - } - - if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { - return false; - } - - _.unload(); - - _.$slideTrack.children(this.options.slide).eq(index).remove(); - - _.$slides = _.$slideTrack.children(this.options.slide); - - _.$slideTrack.children(this.options.slide).detach(); - - _.$slideTrack.append(_.$slides); - - _.$slidesCache = _.$slides; - - _.reinit(); - - }; - - Slick.prototype.setCSS = function(position) { - - var _ = this, - positionProps = {}, x, y; - - if (_.options.rtl === true) { - position = -position; - } - x = _.positionProp == 'left' ? position + 'px' : '0px'; - y = _.positionProp == 'top' ? position + 'px' : '0px'; - - positionProps[_.positionProp] = position; - - if (_.transformsEnabled === false) { - _.$slideTrack.css(positionProps); - } else { - positionProps = {}; - if (_.cssTransitions === false) { - positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; - _.$slideTrack.css(positionProps); - } else { - positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; - _.$slideTrack.css(positionProps); - } - } - - }; - - Slick.prototype.setDimensions = function() { - - var _ = this; - - if (_.options.vertical === false) { - if (_.options.centerMode === true) { - _.$list.css({ - padding: ('0px ' + _.options.centerPadding) - }); - } - } else { - _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); - if (_.options.centerMode === true) { - _.$list.css({ - padding: (_.options.centerPadding + ' 0px') - }); - } - } - - _.listWidth = _.$list.width(); - _.listHeight = _.$list.height(); - - - if(_.options.vertical === false && _.options.variableWidth === false) { - _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); - _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); - - } else if (_.options.variableWidth === true) { - _.slideWidth = 0; - _.$slideTrack.children('.slick-slide').each(function(){ - _.slideWidth += Math.ceil($(this).outerWidth(true)); - }); - _.$slideTrack.width(Math.ceil(_.slideWidth) + 1); - } else { - _.slideWidth = Math.ceil(_.listWidth); - _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); - } - - var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); - if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); - - }; - - Slick.prototype.setFade = function() { - - var _ = this, - targetLeft; - - _.$slides.each(function(index, element) { - targetLeft = (_.slideWidth * index) * -1; - $(element).css({ - position: 'relative', - left: targetLeft, - top: 0, - zIndex: 800, - opacity: 0 - }); - }); - - _.$slides.eq(_.currentSlide).css({ - zIndex: 900, - opacity: 1 - }); - - }; - - Slick.prototype.setHeight = function() { - - var _ = this; - - if(_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { - var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); - _.$list.css('height', targetHeight); - } - - }; - - Slick.prototype.setPosition = function() { - - var _ = this; - - _.setDimensions(); - - _.setHeight(); - - if (_.options.fade === false) { - _.setCSS(_.getLeft(_.currentSlide)); - } else { - _.setFade(); - } - - }; - - Slick.prototype.setProps = function() { - - var _ = this, - bodyStyle = document.body.style; - - _.positionProp = _.options.vertical === true ? 'top' : 'left'; - - if (_.positionProp === 'top') { - _.$slider.addClass('slick-vertical'); - } else { - _.$slider.removeClass('slick-vertical'); - } - - if (bodyStyle.WebkitTransition !== undefined || - bodyStyle.MozTransition !== undefined || - bodyStyle.msTransition !== undefined) { - if(_.options.useCSS === true) { - _.cssTransitions = true; - } - } - - if (bodyStyle.OTransform !== undefined) { - _.animType = 'OTransform'; - _.transformType = "-o-transform"; - _.transitionType = 'OTransition'; - if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; - } - if (bodyStyle.MozTransform !== undefined) { - _.animType = 'MozTransform'; - _.transformType = "-moz-transform"; - _.transitionType = 'MozTransition'; - if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; - } - if (bodyStyle.webkitTransform !== undefined) { - _.animType = 'webkitTransform'; - _.transformType = "-webkit-transform"; - _.transitionType = 'webkitTransition'; - if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; - } - if (bodyStyle.msTransform !== undefined) { - _.animType = 'msTransform'; - _.transformType = "-ms-transform"; - _.transitionType = 'msTransition'; - if (bodyStyle.msTransform === undefined) _.animType = false; - } - if (bodyStyle.transform !== undefined && _.animType !== false) { - _.animType = 'transform'; - _.transformType = "transform"; - _.transitionType = 'transition'; - } - _.transformsEnabled = (_.animType !== null && _.animType !== false); - - }; - - - Slick.prototype.setSlideClasses = function(index) { - - var _ = this, - centerOffset, allSlides, indexOffset, remainder; - - _.$slider.find('.slick-slide').removeClass('slick-active').removeClass('slick-center'); - allSlides = _.$slider.find('.slick-slide'); - - if (_.options.centerMode === true) { - - centerOffset = Math.floor(_.options.slidesToShow / 2); - - if(_.options.infinite === true) { - - if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { - _.$slides.slice(index - centerOffset, index + centerOffset + 1).addClass('slick-active'); - } else { - indexOffset = _.options.slidesToShow + index; - allSlides.slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2).addClass('slick-active'); - } - - if (index === 0) { - allSlides.eq(allSlides.length - 1 - _.options.slidesToShow).addClass('slick-center'); - } else if (index === _.slideCount - 1) { - allSlides.eq(_.options.slidesToShow).addClass('slick-center'); - } - - } - - _.$slides.eq(index).addClass('slick-center'); - - } else { - - if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { - _.$slides.slice(index, index + _.options.slidesToShow).addClass('slick-active'); - } else if ( allSlides.length <= _.options.slidesToShow ) { - allSlides.addClass('slick-active'); - } else { - remainder = _.slideCount%_.options.slidesToShow; - indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; - if(_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { - allSlides.slice(indexOffset-(_.options.slidesToShow-remainder), indexOffset + remainder).addClass('slick-active'); - } else { - allSlides.slice(indexOffset, indexOffset + _.options.slidesToShow).addClass('slick-active'); - } - } - - } - - if (_.options.lazyLoad === 'ondemand') { - _.lazyLoad(); - } - - }; - - Slick.prototype.setupInfinite = function() { - - var _ = this, - i, slideIndex, infiniteCount; - - if (_.options.fade === true || _.options.vertical === true) { - _.options.centerMode = false; - } - - if (_.options.infinite === true && _.options.fade === false) { - - slideIndex = null; - - if (_.slideCount > _.options.slidesToShow) { - - if (_.options.centerMode === true) { - infiniteCount = _.options.slidesToShow + 1; - } else { - infiniteCount = _.options.slidesToShow; - } - - for (i = _.slideCount; i > (_.slideCount - - infiniteCount); i -= 1) { - slideIndex = i - 1; - $(_.$slides[slideIndex]).clone(true).attr('id', '') - .attr('index', slideIndex-_.slideCount) - .prependTo(_.$slideTrack).addClass('slick-cloned'); - } - for (i = 0; i < infiniteCount; i += 1) { - slideIndex = i; - $(_.$slides[slideIndex]).clone(true).attr('id', '') - .attr('index', slideIndex+_.slideCount) - .appendTo(_.$slideTrack).addClass('slick-cloned'); - } - _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { - $(this).attr('id', ''); - }); - - } - - } - - }; - - Slick.prototype.selectHandler = function(event) { - - var _ = this; - var index = parseInt($(event.target).parents('.slick-slide').attr("index")); - if(!index) index = 0; - - if(_.slideCount <= _.options.slidesToShow){ - return; - } - _.slideHandler(index); - - }; - - Slick.prototype.slideHandler = function(index,sync) { - - var targetSlide, animSlide, slideLeft, unevenOffset, targetLeft = null, - _ = this; - - sync = sync || false; - - if (_.animating === true && _.options.waitForAnimate === true) { - return false; - } - - if (sync === false) { - _.asNavFor(index); - } - - targetSlide = index; - targetLeft = _.getLeft(targetSlide); - slideLeft = _.getLeft(_.currentSlide); - - unevenOffset = _.slideCount % _.options.slidesToScroll !== 0 ? _.options.slidesToScroll : 0; - - _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; - - if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > (_.slideCount - _.options.slidesToShow + unevenOffset))) { - if(_.options.fade === false) { - targetSlide = _.currentSlide; - _.animateSlide(slideLeft, function() { - _.postSlide(targetSlide); - }); - } - return false; - } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { - if(_.options.fade === false) { - targetSlide = _.currentSlide; - _.animateSlide(slideLeft, function() { - _.postSlide(targetSlide); - }); - } - return false; - } - - if (_.options.autoplay === true) { - clearInterval(_.autoPlayTimer); - } - - if (targetSlide < 0) { - if (_.slideCount % _.options.slidesToScroll !== 0) { - animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); - } else { - animSlide = _.slideCount + targetSlide; - } - } else if (targetSlide >= _.slideCount) { - if (_.slideCount % _.options.slidesToScroll !== 0) { - animSlide = 0; - } else { - animSlide = targetSlide - _.slideCount; - } - } else { - animSlide = targetSlide; - } - - _.animating = true; - - if (_.options.onBeforeChange !== null && index !== _.currentSlide) { - _.options.onBeforeChange.call(this, _, _.currentSlide, animSlide); - } - - _.currentSlide = animSlide; - - _.setSlideClasses(_.currentSlide); - - _.updateDots(); - _.updateArrows(); - - if (_.options.fade === true) { - _.fadeSlide(animSlide, function() { - _.postSlide(animSlide); - }); - return false; - } - - _.animateSlide(targetLeft, function() { - _.postSlide(animSlide); - }); - - }; - - Slick.prototype.startLoad = function() { - - var _ = this; - - if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { - - _.$prevArrow.hide(); - _.$nextArrow.hide(); - - } - - if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { - - _.$dots.hide(); - - } - - _.$slider.addClass('slick-loading'); - - }; - - Slick.prototype.swipeDirection = function() { - - var xDist, yDist, r, swipeAngle, _ = this; - - xDist = _.touchObject.startX - _.touchObject.curX; - yDist = _.touchObject.startY - _.touchObject.curY; - r = Math.atan2(yDist, xDist); - - swipeAngle = Math.round(r * 180 / Math.PI); - if (swipeAngle < 0) { - swipeAngle = 360 - Math.abs(swipeAngle); - } - - if ((swipeAngle <= 45) && (swipeAngle >= 0)) { - return 'left'; - } - if ((swipeAngle <= 360) && (swipeAngle >= 315)) { - return 'left'; - } - if ((swipeAngle >= 135) && (swipeAngle <= 225)) { - return 'right'; - } - - return 'vertical'; - - }; - - Slick.prototype.swipeEnd = function(event) { - - var _ = this, slideCount, slidesTraversed, swipeDiff; - - _.dragging = false; - - if (_.touchObject.curX === undefined) { - return false; - } - - if (_.touchObject.swipeLength >= _.touchObject.minSwipe) { - $(event.target).on('click.slick', function(event) { - event.stopImmediatePropagation(); - event.stopPropagation(); - event.preventDefault(); - $(event.target).off('click.slick'); - }); - - if(_.options.swipeToSlide === true) { - slidesTraversed = Math.round(_.touchObject.swipeLength / _.slideWidth); - slideCount = slidesTraversed - } else { - slideCount = _.options.slidesToScroll; - } - - switch (_.swipeDirection()) { - case 'left': - _.slideHandler(_.currentSlide + slideCount); - _.touchObject = {}; - break; - - case 'right': - _.slideHandler(_.currentSlide - slideCount); - _.touchObject = {}; - break; - } - } else { - if(_.touchObject.startX !== _.touchObject.curX) { - _.slideHandler(_.currentSlide); - _.touchObject = {}; - } - } - - }; - - Slick.prototype.swipeHandler = function(event) { - - var _ = this; - - if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { - return; - } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { - return; - } - - _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? - event.originalEvent.touches.length : 1; - - _.touchObject.minSwipe = _.listWidth / _.options - .touchThreshold; - - switch (event.data.action) { - - case 'start': - _.swipeStart(event); - break; - - case 'move': - _.swipeMove(event); - break; - - case 'end': - _.swipeEnd(event); - break; - - } - - }; - - Slick.prototype.swipeMove = function(event) { - - var _ = this, - curLeft, swipeDirection, positionOffset, touches; - - touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; - - curLeft = _.getLeft(_.currentSlide); - - if (!_.dragging || touches && touches.length !== 1) { - return false; - } - - _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; - _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; - - _.touchObject.swipeLength = Math.round(Math.sqrt( - Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); - - swipeDirection = _.swipeDirection(); - - if (swipeDirection === 'vertical') { - return; - } - - if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { - event.preventDefault(); - } - - positionOffset = _.touchObject.curX > _.touchObject.startX ? 1 : -1; - - if (_.options.vertical === false) { - _.swipeLeft = curLeft + _.touchObject.swipeLength * positionOffset; - } else { - _.swipeLeft = curLeft + (_.touchObject - .swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; - } - - if (_.options.fade === true || _.options.touchMove === false) { - return false; - } - - if (_.animating === true) { - _.swipeLeft = null; - return false; - } - - _.setCSS(_.swipeLeft); - - }; - - Slick.prototype.swipeStart = function(event) { - - var _ = this, - touches; - - if (event.target.nodeName === 'IMG') { - event.preventDefault(); - } - - if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { - _.touchObject = {}; - return false; - } - - if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { - touches = event.originalEvent.touches[0]; - } - - _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; - _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; - - _.dragging = true; - - }; - - Slick.prototype.unfilterSlides = function() { - - var _ = this; - - if (_.$slidesCache !== null) { - - _.unload(); - - _.$slideTrack.children(this.options.slide).detach(); - - _.$slidesCache.appendTo(_.$slideTrack); - - _.reinit(); - - } - - }; - - Slick.prototype.unload = function() { - - var _ = this; - - $('.slick-cloned', _.$slider).remove(); - if (_.$dots) { - _.$dots.remove(); - } - if (_.$prevArrow) { - _.$prevArrow.remove(); - _.$nextArrow.remove(); - } - _.$slides.removeClass( - 'slick-slide slick-active slick-visible').css('width', ''); - - }; - - Slick.prototype.updateArrows = function() { - - var _ = this; - - if (_.options.arrows === true && _.options.infinite !== - true && _.slideCount > _.options.slidesToShow) { - _.$prevArrow.removeClass('slick-disabled'); - _.$nextArrow.removeClass('slick-disabled'); - if (_.currentSlide === 0) { - _.$prevArrow.addClass('slick-disabled'); - _.$nextArrow.removeClass('slick-disabled'); - } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { - _.$nextArrow.addClass('slick-disabled'); - _.$prevArrow.removeClass('slick-disabled'); - } - } - - }; - - Slick.prototype.updateDots = function() { - - var _ = this; - - if (_.$dots !== null) { - - _.$dots.find('li').removeClass('slick-active'); - _.$dots.find('li').eq(Math.floor(_.currentSlide / _.options.slidesToScroll)).addClass('slick-active'); - - } - - }; - - $.fn.slick = function(options) { - var _ = this; - return _.each(function(index, element) { - - element.slick = new Slick(element, options); - - }); - }; - - $.fn.slickAdd = function(slide, slideIndex, addBefore) { - var _ = this; - return _.each(function(index, element) { - - element.slick.addSlide(slide, slideIndex, addBefore); - - }); - }; - - $.fn.slickCurrentSlide = function() { - var _ = this; - return _.get(0).slick.getCurrent(); - }; - - $.fn.slickFilter = function(filter) { - var _ = this; - return _.each(function(index, element) { - - element.slick.filterSlides(filter); - - }); - }; - - $.fn.slickGoTo = function(slide) { - var _ = this; - return _.each(function(index, element) { - - element.slick.changeSlide({ - data: { - message: 'index', - index: parseInt(slide) - } - }); - - }); - }; - - $.fn.slickNext = function() { - var _ = this; - return _.each(function(index, element) { - - element.slick.changeSlide({ - data: { - message: 'next' - } - }); - - }); - }; - - $.fn.slickPause = function() { - var _ = this; - return _.each(function(index, element) { - - element.slick.autoPlayClear(); - element.slick.paused = true; - - }); - }; - - $.fn.slickPlay = function() { - var _ = this; - return _.each(function(index, element) { - - element.slick.paused = false; - element.slick.autoPlay(); - - }); - }; - - $.fn.slickPrev = function() { - var _ = this; - return _.each(function(index, element) { - - element.slick.changeSlide({ - data: { - message: 'previous' - } - }); - - }); - }; - - $.fn.slickRemove = function(slideIndex, removeBefore) { - var _ = this; - return _.each(function(index, element) { - - element.slick.removeSlide(slideIndex, removeBefore); - - }); - }; - - $.fn.slickGetOption = function(option) { - var _ = this; - return _.get(0).slick.options[option]; - }; - - $.fn.slickSetOption = function(option, value, refresh) { - var _ = this; - return _.each(function(index, element) { - - element.slick.options[option] = value; - - if (refresh === true) { - element.slick.unload(); - element.slick.reinit(); - } - - }); - }; - - $.fn.slickUnfilter = function() { - var _ = this; - return _.each(function(index, element) { - - element.slick.unfilterSlides(); - - }); - }; - - $.fn.unslick = function() { - var _ = this; - return _.each(function(index, element) { - - if (element.slick) { - element.slick.destroy(); - } - - }); - }; - - $.fn.getSlick = function() { - var s = null; - var _ = this; - _.each(function(index, element) { - s = element.slick; - }); - - return s; - }; - -})); diff --git a/scripts/slick-1.3.9/slick/slick.min.js b/scripts/slick-1.3.9/slick/slick.min.js deleted file mode 100755 index d69e463..0000000 --- a/scripts/slick-1.3.9/slick/slick.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};e=function(){function e(e,o){var s,n,l=this;if(l.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(e),appendDots:i(e),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(i,e){return'"},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",fade:!1,focusOnSelect:!1,infinite:!0,lazyLoad:"ondemand",onBeforeChange:null,onAfterChange:null,onInit:null,onReInit:null,pauseOnHover:!0,pauseOnDotsHover:!1,responsive:null,rtl:!1,slide:"div",slidesToShow:1,slidesToScroll:1,speed:300,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,variableWidth:!1,vertical:!1,waitForAnimate:!0},l.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentSlide:0,currentLeft:null,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,$list:null,touchObject:{},transformsEnabled:!1},i.extend(l,l.initials),l.activeBreakpoint=null,l.animType=null,l.animProp=null,l.breakpoints=[],l.breakpointSettings=[],l.cssTransitions=!1,l.paused=!1,l.positionProp=null,l.$slider=i(e),l.$slidesCache=null,l.transformType=null,l.transitionType=null,l.windowWidth=0,l.windowTimer=null,l.options=i.extend({},l.defaults,o),l.originalSettings=l.options,s=l.options.responsive||null,s&&s.length>-1){for(n in s)s.hasOwnProperty(n)&&(l.breakpoints.push(s[n].breakpoint),l.breakpointSettings[s[n].breakpoint]=s[n].settings);l.breakpoints.sort(function(i,e){return e-i})}l.autoPlay=i.proxy(l.autoPlay,l),l.autoPlayClear=i.proxy(l.autoPlayClear,l),l.changeSlide=i.proxy(l.changeSlide,l),l.selectHandler=i.proxy(l.selectHandler,l),l.setPosition=i.proxy(l.setPosition,l),l.swipeHandler=i.proxy(l.swipeHandler,l),l.dragHandler=i.proxy(l.dragHandler,l),l.keyHandler=i.proxy(l.keyHandler,l),l.autoPlayIterator=i.proxy(l.autoPlayIterator,l),l.instanceUid=t++,l.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,l.init()}var t=0;return e}(),e.prototype.addSlide=function(e,t,o){var s=this;if("boolean"==typeof t)o=t,t=null;else if(0>t||t>=s.slideCount)return!1;s.unload(),"number"==typeof t?0===t&&0===s.$slides.length?i(e).appendTo(s.$slideTrack):o?i(e).insertBefore(s.$slides.eq(t)):i(e).insertAfter(s.$slides.eq(t)):o===!0?i(e).prependTo(s.$slideTrack):i(e).appendTo(s.$slideTrack),s.$slides=s.$slideTrack.children(this.options.slide),s.$slideTrack.children(this.options.slide).detach(),s.$slideTrack.append(s.$slides),s.$slides.each(function(e,t){i(t).attr("index",e)}),s.$slidesCache=s.$slides,s.reinit()},e.prototype.animateSlide=function(e,t){var o={},s=this;if(1===s.options.slidesToShow&&s.options.adaptiveHeight===!0&&s.options.vertical===!1){var n=s.$slides.eq(s.currentSlide).outerHeight(!0);s.$list.animate({height:n},s.options.speed)}s.options.rtl===!0&&s.options.vertical===!1&&(e=-e),s.transformsEnabled===!1?s.options.vertical===!1?s.$slideTrack.animate({left:e},s.options.speed,s.options.easing,t):s.$slideTrack.animate({top:e},s.options.speed,s.options.easing,t):s.cssTransitions===!1?i({animStart:s.currentLeft}).animate({animStart:e},{duration:s.options.speed,easing:s.options.easing,step:function(i){s.options.vertical===!1?(o[s.animType]="translate("+i+"px, 0px)",s.$slideTrack.css(o)):(o[s.animType]="translate(0px,"+i+"px)",s.$slideTrack.css(o))},complete:function(){t&&t.call()}}):(s.applyTransition(),o[s.animType]=s.options.vertical===!1?"translate3d("+e+"px, 0px, 0px)":"translate3d(0px,"+e+"px, 0px)",s.$slideTrack.css(o),t&&setTimeout(function(){s.disableTransition(),t.call()},s.options.speed))},e.prototype.asNavFor=function(e){var t=this,o=null!=t.options.asNavFor?i(t.options.asNavFor).getSlick():null;null!=o&&o.slideHandler(e,!0)},e.prototype.applyTransition=function(i){var e=this,t={};t[e.transitionType]=e.options.fade===!1?e.transformType+" "+e.options.speed+"ms "+e.options.cssEase:"opacity "+e.options.speed+"ms "+e.options.cssEase,e.options.fade===!1?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.autoPlay=function(){var i=this;i.autoPlayTimer&&clearInterval(i.autoPlayTimer),i.slideCount>i.options.slidesToShow&&i.paused!==!0&&(i.autoPlayTimer=setInterval(i.autoPlayIterator,i.options.autoplaySpeed))},e.prototype.autoPlayClear=function(){var i=this;i.autoPlayTimer&&clearInterval(i.autoPlayTimer)},e.prototype.autoPlayIterator=function(){var i=this;i.options.infinite===!1?1===i.direction?(i.currentSlide+1===i.slideCount-1&&(i.direction=0),i.slideHandler(i.currentSlide+i.options.slidesToScroll)):(i.currentSlide-1===0&&(i.direction=1),i.slideHandler(i.currentSlide-i.options.slidesToScroll)):i.slideHandler(i.currentSlide+i.options.slidesToScroll)},e.prototype.buildArrows=function(){var e=this;e.options.arrows===!0&&e.slideCount>e.options.slidesToShow&&(e.$prevArrow=i(e.options.prevArrow),e.$nextArrow=i(e.options.nextArrow),e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.appendTo(e.options.appendArrows),e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.appendTo(e.options.appendArrows),e.options.infinite!==!0&&e.$prevArrow.addClass("slick-disabled"))},e.prototype.buildDots=function(){var e,t,o=this;if(o.options.dots===!0&&o.slideCount>o.options.slidesToShow){for(t='
    ',e=0;e<=o.getDotCount();e+=1)t+="
  • "+o.options.customPaging.call(this,o,e)+"
  • ";t+="
",o.$dots=i(t).appendTo(o.options.appendDots),o.$dots.find("li").first().addClass("slick-active")}},e.prototype.buildOut=function(){var e=this;e.$slides=e.$slider.children(e.options.slide+":not(.slick-cloned)").addClass("slick-slide"),e.slideCount=e.$slides.length,e.$slides.each(function(e,t){i(t).attr("index",e)}),e.$slidesCache=e.$slides,e.$slider.addClass("slick-slider"),e.$slideTrack=0===e.slideCount?i('
').appendTo(e.$slider):e.$slides.wrapAll('
').parent(),e.$list=e.$slideTrack.wrap('
').parent(),e.$slideTrack.css("opacity",0),e.options.centerMode===!0&&(e.options.slidesToScroll=1,e.options.slidesToShow%2===0&&(e.options.slidesToShow=3)),i("img[data-lazy]",e.$slider).not("[src]").addClass("slick-loading"),e.setupInfinite(),e.buildArrows(),e.buildDots(),e.updateDots(),e.options.accessibility===!0&&e.$list.prop("tabIndex",0),e.setSlideClasses("number"==typeof this.currentSlide?this.currentSlide:0),e.options.draggable===!0&&e.$list.addClass("draggable")},e.prototype.checkResponsive=function(){var e,t,o=this;if(o.originalSettings.responsive&&o.originalSettings.responsive.length>-1&&null!==o.originalSettings.responsive){t=null;for(e in o.breakpoints)o.breakpoints.hasOwnProperty(e)&&i(window).width()n.options.slidesToShow&&n.slideHandler(n.currentSlide-o);break;case"next":o=0===t?n.options.slidesToScroll:t,n.slideCount>n.options.slidesToShow&&n.slideHandler(n.currentSlide+o);break;case"index":var r=0===e.data.index?0:e.data.index||i(e.target).parent().index()*n.options.slidesToScroll;n.slideHandler(r);default:return!1}},e.prototype.destroy=function(){var e=this;e.autoPlayClear(),e.touchObject={},i(".slick-cloned",e.$slider).remove(),e.$dots&&e.$dots.remove(),e.$prevArrow&&(e.$prevArrow.remove(),e.$nextArrow.remove()),e.$slides.parent().hasClass("slick-track")&&e.$slides.unwrap().unwrap(),e.$slides.removeClass("slick-slide slick-active slick-visible").css("width",""),e.$slider.removeClass("slick-slider"),e.$slider.removeClass("slick-initialized"),e.$list.off(".slick"),i(window).off(".slick-"+e.instanceUid),i(document).off(".slick-"+e.instanceUid)},e.prototype.disableTransition=function(i){var e=this,t={};t[e.transitionType]="",e.options.fade===!1?e.$slideTrack.css(t):e.$slides.eq(i).css(t)},e.prototype.fadeSlide=function(i,e){var t=this;t.cssTransitions===!1?(t.$slides.eq(i).css({zIndex:1e3}),t.$slides.eq(i).animate({opacity:1},t.options.speed,t.options.easing,e)):(t.applyTransition(i),t.$slides.eq(i).css({opacity:1,zIndex:1e3}),e&&setTimeout(function(){t.disableTransition(i),e.call()},t.options.speed))},e.prototype.filterSlides=function(i){var e=this;null!==i&&(e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.filter(i).appendTo(e.$slideTrack),e.reinit())},e.prototype.getCurrent=function(){var i=this;return i.currentSlide},e.prototype.getDotCount=function(){var i,e=this,t=0,o=0,s=0;for(i=e.options.infinite===!0?e.slideCount+e.options.slidesToShow-e.options.slidesToScroll:e.slideCount;i>t;)s++,o+=e.options.slidesToScroll,t=o+e.options.slidesToShow;return s},e.prototype.getLeft=function(i){var e,t,o,s=this,n=0;return s.slideOffset=0,t=s.$slides.first().outerHeight(),s.options.infinite===!0?(s.slideCount>s.options.slidesToShow&&(s.slideOffset=s.slideWidth*s.options.slidesToShow*-1,n=t*s.options.slidesToShow*-1),s.slideCount%s.options.slidesToScroll!==0&&i+s.options.slidesToScroll>s.slideCount&&s.slideCount>s.options.slidesToShow&&(s.slideOffset=s.slideCount%s.options.slidesToShow*s.slideWidth*-1,n=s.slideCount%s.options.slidesToShow*t*-1)):s.slideCount%s.options.slidesToShow!==0&&i+s.options.slidesToScroll>s.slideCount&&s.slideCount>s.options.slidesToShow&&(s.slideOffset=s.options.slidesToShow*s.slideWidth-s.slideCount%s.options.slidesToShow*s.slideWidth,n=s.slideCount%s.options.slidesToShow*t),s.slideCount>s.options.slidesToShow||(s.slideOffset=0,n=0),s.options.centerMode===!0&&s.options.infinite===!0?s.slideOffset+=s.slideWidth*Math.floor(s.options.slidesToShow/2)-s.slideWidth:s.options.centerMode===!0&&(s.slideOffset+=s.slideWidth*Math.floor(s.options.slidesToShow/2)),e=s.options.vertical===!1?i*s.slideWidth*-1+s.slideOffset:i*t*-1+n,s.options.variableWidth===!0&&(o=s.$slideTrack.children(".slick-slide").eq(s.slideCount>s.options.slidesToShow&&s.options.infinite!==!1?i+s.options.slidesToShow:i),e=o[0]?-1*o[0].offsetLeft:0,s.options.centerMode===!0&&(o=s.$slideTrack.children(".slick-slide").eq(i+s.options.slidesToShow+1),e=o[0]?-1*o[0].offsetLeft:0,e+=(s.$list.width()-o.outerWidth())/2)),e},e.prototype.init=function(){var e=this;i(e.$slider).hasClass("slick-initialized")||(i(e.$slider).addClass("slick-initialized"),e.buildOut(),e.setProps(),e.startLoad(),e.loadSlider(),e.initializeEvents(),e.checkResponsive()),null!==e.options.onInit&&e.options.onInit.call(this,e)},e.prototype.initArrowEvents=function(){var i=this;i.options.arrows===!0&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.on("click.slick",{message:"previous"},i.changeSlide),i.$nextArrow.on("click.slick",{message:"next"},i.changeSlide))},e.prototype.initDotEvents=function(){var e=this;e.options.dots===!0&&e.slideCount>e.options.slidesToShow&&i("li",e.$dots).on("click.slick",{message:"index"},e.changeSlide),e.options.dots===!0&&e.options.pauseOnDotsHover===!0&&e.options.autoplay===!0&&i("li",e.$dots).on("mouseenter.slick",e.autoPlayClear).on("mouseleave.slick",e.autoPlay)},e.prototype.initializeEvents=function(){var e=this;e.initArrowEvents(),e.initDotEvents(),e.$list.on("touchstart.slick mousedown.slick",{action:"start"},e.swipeHandler),e.$list.on("touchmove.slick mousemove.slick",{action:"move"},e.swipeHandler),e.$list.on("touchend.slick mouseup.slick",{action:"end"},e.swipeHandler),e.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},e.swipeHandler),e.options.pauseOnHover===!0&&e.options.autoplay===!0&&(e.$list.on("mouseenter.slick",e.autoPlayClear),e.$list.on("mouseleave.slick",e.autoPlay)),e.options.accessibility===!0&&e.$list.on("keydown.slick",e.keyHandler),e.options.focusOnSelect===!0&&i(e.options.slide,e.$slideTrack).on("click.slick",e.selectHandler),i(window).on("orientationchange.slick.slick-"+e.instanceUid,function(){e.checkResponsive(),e.setPosition()}),i(window).on("resize.slick.slick-"+e.instanceUid,function(){i(window).width()!==e.windowWidth&&(clearTimeout(e.windowDelay),e.windowDelay=window.setTimeout(function(){e.windowWidth=i(window).width(),e.checkResponsive(),e.setPosition()},50))}),i(window).on("load.slick.slick-"+e.instanceUid,e.setPosition),i(document).on("ready.slick.slick-"+e.instanceUid,e.setPosition)},e.prototype.initUI=function(){var i=this;i.options.arrows===!0&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.show(),i.$nextArrow.show()),i.options.dots===!0&&i.slideCount>i.options.slidesToShow&&i.$dots.show(),i.options.autoplay===!0&&i.autoPlay()},e.prototype.keyHandler=function(i){var e=this;37===i.keyCode?e.changeSlide({data:{message:"previous"}}):39===i.keyCode&&e.changeSlide({data:{message:"next"}})},e.prototype.lazyLoad=function(){function e(e){i("img[data-lazy]",e).each(function(){var e=i(this),t=i(this).attr("data-lazy");e.load(function(){e.animate({opacity:1},200)}).css({opacity:0}).attr("src",t).removeAttr("data-lazy").removeClass("slick-loading")})}var t,o,s,n,l=this;l.options.centerMode===!0?l.options.infinite===!0?(s=l.currentSlide+(l.options.slidesToShow/2+1),n=s+l.options.slidesToShow+2):(s=Math.max(0,l.currentSlide-(l.options.slidesToShow/2+1)),n=2+(l.options.slidesToShow/2+1)+l.currentSlide):(s=l.options.infinite?l.options.slidesToShow+l.currentSlide:l.currentSlide,n=s+l.options.slidesToShow,l.options.fade===!0&&(s>0&&s--,n>l.slideCount||n++)),t=l.$slider.find(".slick-slide").slice(s,n),e(t),l.slideCount>l.options.slidesToShow?l.currentSlide0&&(t=i("img[data-lazy]",o.$slider).first(),t.attr("src",t.attr("data-lazy")).removeClass("slick-loading").load(function(){t.removeAttr("data-lazy"),o.progressiveLazyLoad()}).error(function(){t.removeAttr("data-lazy"),o.progressiveLazyLoad()}))},e.prototype.refresh=function(){var e=this,t=e.currentSlide;e.destroy(),i.extend(e,e.initials),e.currentSlide=t,e.init()},e.prototype.reinit=function(){var e=this;e.$slides=e.$slideTrack.children(e.options.slide).addClass("slick-slide"),e.slideCount=e.$slides.length,e.currentSlidee.options.slidesToShow||(e.currentSlide=0),e.setProps(),e.setupInfinite(),e.buildArrows(),e.updateArrows(),e.initArrowEvents(),e.buildDots(),e.updateDots(),e.initDotEvents(),e.options.focusOnSelect===!0&&i(e.options.slide,e.$slideTrack).on("click.slick",e.selectHandler),e.setSlideClasses(0),e.setPosition(),null!==e.options.onReInit&&e.options.onReInit.call(this,e)},e.prototype.removeSlide=function(i,e){var t=this;return"boolean"==typeof i?(e=i,i=e===!0?0:t.slideCount-1):i=e===!0?--i:i,t.slideCount<1||0>i||i>t.slideCount-1?!1:(t.unload(),t.$slideTrack.children(this.options.slide).eq(i).remove(),t.$slides=t.$slideTrack.children(this.options.slide),t.$slideTrack.children(this.options.slide).detach(),t.$slideTrack.append(t.$slides),t.$slidesCache=t.$slides,void t.reinit())},e.prototype.setCSS=function(i){var e,t,o=this,s={};o.options.rtl===!0&&(i=-i),e="left"==o.positionProp?i+"px":"0px",t="top"==o.positionProp?i+"px":"0px",s[o.positionProp]=i,o.transformsEnabled===!1?o.$slideTrack.css(s):(s={},o.cssTransitions===!1?(s[o.animType]="translate("+e+", "+t+")",o.$slideTrack.css(s)):(s[o.animType]="translate3d("+e+", "+t+", 0px)",o.$slideTrack.css(s)))},e.prototype.setDimensions=function(){var e=this;e.options.vertical===!1?e.options.centerMode===!0&&e.$list.css({padding:"0px "+e.options.centerPadding}):(e.$list.height(e.$slides.first().outerHeight(!0)*e.options.slidesToShow),e.options.centerMode===!0&&e.$list.css({padding:e.options.centerPadding+" 0px"})),e.listWidth=e.$list.width(),e.listHeight=e.$list.height(),e.options.vertical===!1&&e.options.variableWidth===!1?(e.slideWidth=Math.ceil(e.listWidth/e.options.slidesToShow),e.$slideTrack.width(Math.ceil(e.slideWidth*e.$slideTrack.children(".slick-slide").length))):e.options.variableWidth===!0?(e.slideWidth=0,e.$slideTrack.children(".slick-slide").each(function(){e.slideWidth+=Math.ceil(i(this).outerWidth(!0))}),e.$slideTrack.width(Math.ceil(e.slideWidth)+1)):(e.slideWidth=Math.ceil(e.listWidth),e.$slideTrack.height(Math.ceil(e.$slides.first().outerHeight(!0)*e.$slideTrack.children(".slick-slide").length)));var t=e.$slides.first().outerWidth(!0)-e.$slides.first().width();e.options.variableWidth===!1&&e.$slideTrack.children(".slick-slide").width(e.slideWidth-t)},e.prototype.setFade=function(){var e,t=this;t.$slides.each(function(o,s){e=t.slideWidth*o*-1,i(s).css({position:"relative",left:e,top:0,zIndex:800,opacity:0})}),t.$slides.eq(t.currentSlide).css({zIndex:900,opacity:1})},e.prototype.setHeight=function(){var i=this;if(1===i.options.slidesToShow&&i.options.adaptiveHeight===!0&&i.options.vertical===!1){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.css("height",e)}},e.prototype.setPosition=function(){var i=this;i.setDimensions(),i.setHeight(),i.options.fade===!1?i.setCSS(i.getLeft(i.currentSlide)):i.setFade()},e.prototype.setProps=function(){var i=this,e=document.body.style;i.positionProp=i.options.vertical===!0?"top":"left","top"===i.positionProp?i.$slider.addClass("slick-vertical"):i.$slider.removeClass("slick-vertical"),(void 0!==e.WebkitTransition||void 0!==e.MozTransition||void 0!==e.msTransition)&&i.options.useCSS===!0&&(i.cssTransitions=!0),void 0!==e.OTransform&&(i.animType="OTransform",i.transformType="-o-transform",i.transitionType="OTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.MozTransform&&(i.animType="MozTransform",i.transformType="-moz-transform",i.transitionType="MozTransition",void 0===e.perspectiveProperty&&void 0===e.MozPerspective&&(i.animType=!1)),void 0!==e.webkitTransform&&(i.animType="webkitTransform",i.transformType="-webkit-transform",i.transitionType="webkitTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(i.animType=!1)),void 0!==e.msTransform&&(i.animType="msTransform",i.transformType="-ms-transform",i.transitionType="msTransition",void 0===e.msTransform&&(i.animType=!1)),void 0!==e.transform&&i.animType!==!1&&(i.animType="transform",i.transformType="transform",i.transitionType="transition"),i.transformsEnabled=null!==i.animType&&i.animType!==!1},e.prototype.setSlideClasses=function(i){var e,t,o,s,n=this;n.$slider.find(".slick-slide").removeClass("slick-active").removeClass("slick-center"),t=n.$slider.find(".slick-slide"),n.options.centerMode===!0?(e=Math.floor(n.options.slidesToShow/2),n.options.infinite===!0&&(e>i||i>n.slideCount-1-e?(o=n.options.slidesToShow+i,t.slice(o-e+1,o+e+2).addClass("slick-active")):n.$slides.slice(i-e,i+e+1).addClass("slick-active"),0===i?t.eq(t.length-1-n.options.slidesToShow).addClass("slick-center"):i===n.slideCount-1&&t.eq(n.options.slidesToShow).addClass("slick-center")),n.$slides.eq(i).addClass("slick-center")):0>i||i>n.slideCount-n.options.slidesToShow?t.length>n.options.slidesToShow?(s=n.slideCount%n.options.slidesToShow,o=n.options.infinite===!0?n.options.slidesToShow+i:i,n.options.slidesToShow==n.options.slidesToScroll&&n.slideCount-is.options.slidesToShow)){for(o=s.options.centerMode===!0?s.options.slidesToShow+1:s.options.slidesToShow,e=s.slideCount;e>s.slideCount-o;e-=1)t=e-1,i(s.$slides[t]).clone(!0).attr("id","").attr("index",t-s.slideCount).prependTo(s.$slideTrack).addClass("slick-cloned");for(e=0;o>e;e+=1)t=e,i(s.$slides[t]).clone(!0).attr("id","").attr("index",t+s.slideCount).appendTo(s.$slideTrack).addClass("slick-cloned");s.$slideTrack.find(".slick-cloned").find("[id]").each(function(){i(this).attr("id","")})}},e.prototype.selectHandler=function(e){var t=this,o=parseInt(i(e.target).parents(".slick-slide").attr("index"));o||(o=0),t.slideCount>t.options.slidesToShow&&t.slideHandler(o)},e.prototype.slideHandler=function(i,e){var t,o,s,n,l=null,r=this;return e=e||!1,r.animating===!0&&r.options.waitForAnimate===!0?!1:(e===!1&&r.asNavFor(i),t=i,l=r.getLeft(t),s=r.getLeft(r.currentSlide),n=r.slideCount%r.options.slidesToScroll!==0?r.options.slidesToScroll:0,r.currentLeft=null===r.swipeLeft?s:r.swipeLeft,r.options.infinite===!1&&r.options.centerMode===!1&&(0>i||i>r.slideCount-r.options.slidesToShow+n)?(r.options.fade===!1&&(t=r.currentSlide,r.animateSlide(s,function(){r.postSlide(t)})),!1):r.options.infinite===!1&&r.options.centerMode===!0&&(0>i||i>r.slideCount-r.options.slidesToScroll)?(r.options.fade===!1&&(t=r.currentSlide,r.animateSlide(s,function(){r.postSlide(t)})),!1):(r.options.autoplay===!0&&clearInterval(r.autoPlayTimer),o=0>t?r.slideCount%r.options.slidesToScroll!==0?r.slideCount-r.slideCount%r.options.slidesToScroll:r.slideCount+t:ti.options.slidesToShow&&(i.$prevArrow.hide(),i.$nextArrow.hide()),i.options.dots===!0&&i.slideCount>i.options.slidesToShow&&i.$dots.hide(),i.$slider.addClass("slick-loading")},e.prototype.swipeDirection=function(){var i,e,t,o,s=this;return i=s.touchObject.startX-s.touchObject.curX,e=s.touchObject.startY-s.touchObject.curY,t=Math.atan2(e,i),o=Math.round(180*t/Math.PI),0>o&&(o=360-Math.abs(o)),(o>45||0>o)&&(o>360||315>o)?135>o||o>225?"vertical":"right":"left"},e.prototype.swipeEnd=function(e){var t,o,s=this;if(s.dragging=!1,void 0===s.touchObject.curX)return!1;if(s.touchObject.swipeLength4&&i.preventDefault(),o=n.touchObject.curX>n.touchObject.startX?1:-1,n.swipeLeft=n.options.vertical===!1?e+n.touchObject.swipeLength*o:e+n.touchObject.swipeLength*(n.$list.height()/n.listWidth)*o,n.options.fade===!0||n.options.touchMove===!1?!1:n.animating===!0?(n.swipeLeft=null,!1):void n.setCSS(n.swipeLeft)):void 0)},e.prototype.swipeStart=function(i){var e,t=this;return"IMG"===i.target.nodeName&&i.preventDefault(),1===t.touchObject.fingerCount&&t.slideCount>t.options.slidesToShow?(void 0!==i.originalEvent&&void 0!==i.originalEvent.touches&&(e=i.originalEvent.touches[0]),t.touchObject.startX=t.touchObject.curX=void 0!==e?e.pageX:i.clientX,t.touchObject.startY=t.touchObject.curY=void 0!==e?e.pageY:i.clientY,void(t.dragging=!0)):(t.touchObject={},!1)},e.prototype.unfilterSlides=function(){var i=this;null!==i.$slidesCache&&(i.unload(),i.$slideTrack.children(this.options.slide).detach(),i.$slidesCache.appendTo(i.$slideTrack),i.reinit())},e.prototype.unload=function(){var e=this;i(".slick-cloned",e.$slider).remove(),e.$dots&&e.$dots.remove(),e.$prevArrow&&(e.$prevArrow.remove(),e.$nextArrow.remove()),e.$slides.removeClass("slick-slide slick-active slick-visible").css("width","")},e.prototype.updateArrows=function(){var i=this;i.options.arrows===!0&&i.options.infinite!==!0&&i.slideCount>i.options.slidesToShow&&(i.$prevArrow.removeClass("slick-disabled"),i.$nextArrow.removeClass("slick-disabled"),0===i.currentSlide?(i.$prevArrow.addClass("slick-disabled"),i.$nextArrow.removeClass("slick-disabled")):i.currentSlide - -``` - -Smooth Scroll requires `bind-polyfill.js`, a polyfill that extends ECMAScript 5 API support to more browsers. - -### 2. Add the markup to your HTML. - -```html -Anchor Link -... -Bazinga! -``` - -Turn anchor links into Smooth Scroll links by adding the `[data-scroll]` data attribute. Give the anchor location an ID just like you normally would. - -### 3. Initialize Smooth Scroll. - -```html - -``` - -In the footer of your page, after the content, initialize Smooth Scroll. And that's it, you're done. Nice work! - - - -## Installing with Package Managers - -You can install Smooth Scroll with your favorite package manager. - -* **[NPM](https://www.npmjs.org/):** `npm install cferdinandi/smooth-scroll` -* **[Bower](http://bower.io/):** `bower install https://github.com/cferdinandi/smooth-scroll.git` -* **[Component](http://component.io/):** `component install cferdinandi/smooth-scroll` - - - -## Options and Settings - -Smooth Scroll includes smart defaults and works right out of the box. But if you want to customize things, it also has a robust API that provides multiple ways for you to adjust the default options and settings. - -### Global Settings - -You can pass options and callbacks into Smooth Scroll through the `init()` function: - -```javascript -smoothScroll.init({ - speed: 500, // Integer. How fast to complete the scroll in milliseconds - easing: 'easeInOutCubic', // Easing pattern to use - updateURL: true, // Boolean. Whether or not to update the URL with the anchor hash on scroll - offset: 0, // Integer. How far to offset the scrolling anchor location in pixels - callbackBefore: function ( toggle, anchor ) {}, // Function to run before scrolling - callbackAfter: function ( toggle, anchor ) {} // Function to run after scrolling -}); -``` - -#### Easing Options - -**Linear** -*Moves at the same speed from start to finish.* - -* `Linear` - - -**Ease-In** -*Gradually increases in speed.* - -* `easeInQuad` -* `easeInCubic` -* `easeInQuart` -* `easeInQuint` - - -**Ease-In-Out** -*Gradually increases in speed, peaks, and then gradually slows down.* - -* `easeInOutQuad` -* `easeInOutCubic` -* `easeInOutQuart` -* `easeInOutQuint` - - -**Ease-Out** -*Gradually decreases in speed.* - -* `easeOutQuad` -* `easeOutCubic` -* `easeOutQuart` -* `easeOutQuint` - - -Learn more about the different easing patterns and what they do at [easings.net](http://easings.net/). - -### Override settings with data attributes - -Smooth Scroll also lets you override global settings on a link-by-link basis using the `[data-options]` data attribute: - -```html - - Anchor Link - -``` - -**Note:** You must use [valid JSON](http://jsonlint.com/) in order for the `data-options` feature to work. - -### Use Smooth Scroll events in your own scripts - -You can also call Smooth Scroll's scroll animation events in your own scripts. - -#### animateScroll() -Animate scrolling to an anchor. - -```javascript -smoothScroll.animateScroll( - toggle, // Node that toggles the animation. ex. document.querySelector('#toggle') - anchor, // ID of the anchor to scroll to. ex. '#bazinga' - options // Classes and callbacks. Same options as those passed into the init() function. -); -``` - -**Example 1** - -```javascript -smoothScroll.animateScroll( null, '#bazinga' ); -``` - -**Example 2** - -```javascript -var toggle = document.querySelector('#toggle'); -var options = { speed: 1000, easing: 'easeOutCubic' }; -smoothScroll.animateScroll( toggle, '#bazinga', options ); -``` - -#### destroy() -Destroy the current `smoothScroll.init()`. - -```javascript -smoothScroll.destroy(); -``` - - -### Fixed Headers - -Add a `[data-scroll-header]` data attribute to fixed headers. Smooth Scroll will automatically offset scroll distances by the header height. If you have multiple fixed headers, add `[data-scroll-header]` to the last one in the markup. - -```html - -``` - - -## Browser Compatibility - -Smooth Scroll works in all modern browsers, and IE 9 and above. - -Smooth Scroll is built with modern JavaScript APIs, and uses progressive enhancement. If the JavaScript file fails to load, or if your site is viewed on older and less capable browsers, anchor links will jump the way they normally would. If you need to smooth scrolling for older browsers, [download the jQuery version of Smooth Scroll on GitHub](https://github.com/cferdinandi/smooth-scroll/tree/archive-v1). - - - -## Contributors - -* Easing support contributed by [Willem Liu](https://github.com/willemliu). -* Easing functions forked from [Gaëtan Renaudeau](https://gist.github.com/gre/1650294). -* URL history support contributed by [Robert Pate](https://github.com/robertpateii). -* Fixed header support contributed by [Arndt von Lucadou](https://github.com/a-v-l). -* Infinite loop bugs in iOS and Chrome (when zoomed) by [Alex Guzman](https://github.com/alexguzman). -* IE10 rounding error fixed by [Luke Siedle](https://github.com/luke-siedle). -* Enhanced callback functions by [Constant Meiring](https://github.com/constantm). -* Scroll-to-top bug for links at the bottom of the page by [Jonas Havers](https://github.com/JonasHavers). -* AMD support and numerous code improvements by [Todd Motto](https://github.com/toddmotto). -* Push State bug fix by [Yanick Witschi](https://github.com/Toflar). - - - -## How to Contribute - -In lieu of a formal style guide, take care to maintain the existing coding style. Don't forget to update the version number, the changelog (in the `readme.md` file), and when applicable, the documentation. - - - -## License -Smooth Scroll is licensed under the [MIT License](http://gomakethings.com/mit/). - - - -## Changelog - -Smooth Scroll uses [semantic versioning](http://semver.org/). - -* v5.1.2 - August 31, 2014 - * Fixed event listener filter to account for sub elements. - * Removed unused `event` argument from `animateScroll` -* v5.1.1 - August 21, 2014 - * Passed in `event` variable to `eventHandler` method, fixing Firefox bug. -* v5.1.0 - August 18, 2014 - * Added `destroy` method. - * Converted to event bubbling approach for better performance. - * Switched to Ruby Sass. -* v5.0.4 - August 15, 2014 - * Added fix for UMD structure. -* v5.0.3 - August 13, 2014 - * Replaced character escaping method with [`CSS.escape`](https://github.com/mathiasbynens/CSS.escape) for more robust character escaping. -* v5.0.2 - August 12, 2014 - * Added character escaping when first character in anchor ID is a number. -* v5.0.1 - August 8, 2014 - * Added polyfill for `Functions.prototype.bind`. - * Removed Sass paths from `gulpfile.js`. -* v5.0.0 - July 21, 2014 - * Updated `data-options` functionality to JSON. - * Fixed update URL bug. - * Set update URL to `true` by default. -* v4.8.2 - June 28, 2014 - * Fixed `extend()` method. -* v4.8.1 - June 27, 2014 - * Fixed problem with `toggles` containing a URL before the fragment identifier -* v4.8.0 - June 21, 2014 - * Converted to gulp.js workflow. - * Added unit testing. - * Added minified versions of files. -* v4.7.2 - June 19, 2014 - * Fixed typo that broke scroll. -* v4.7.1 - June 19, 2014 - * Fixed factory/root/UMD definition. -* v4.7.0 - June 7, 2014 - * Added AMD support. - * Moved public APIs to `exports` variable. - * Improved feature test. - * Replaced `Array.prototype.forEach` hack with proper `forEach` function. - * Added a more well supported `trim` function. - * General code optimizations for better minification and performance. - * Updated to JSDoc documentation (sort of). - * Updated to three number versioning system. - * Added package manager installation info. -* v4.6 - March 21, 2014 - * [Fixed scroll-to-top bug for links at the bottom of the page](https://github.com/cferdinandi/smooth-scroll/issues/49). -* v4.5 - March 20, 2014 - * Added `offset` to `options` -* v4.4 - March 15, 2014 - * [Fixed iOS scroll-to-top bug](https://github.com/cferdinandi/smooth-scroll/issues/45). -* v4.3 - March 5, 2014 - * Added arguments to callback functions for greater versatility. [44](https://github.com/cferdinandi/smooth-scroll/pull/44) -* v4.2 - February 27, 2014 - * Fixed error for null `toggle` argument in `animateScroll` function ([43](https://github.com/cferdinandi/smooth-scroll/issues/43)). -* v4.1 - February 27, 2014 - * Converted `_defaults` to a literal object -* v4.0 - February 21, 2014 - * Better public/private method namespacing. - * Require `init()` call to run. - * New API exposes additional methods for use in your own scripts. - * Better documentation. -* v3.3 - February 19, 2014 - * [Add `offsettTop` to `offsetHeigh`t for `scrollHeader`. Allows for multiple fixed headers, or a fixed header that sits slightly below the top of the page.](https://github.com/cferdinandi/smooth-scroll/pull/36) -* v3.2 - February 10, 2014 - * [Fixes iOS infinite loop](https://github.com/cferdinandi/smooth-scroll/pull/35) and [Chrome browser zoom](https://github.com/cferdinandi/smooth-scroll/issues/31) bugs. -* v3.1 - February 4, 2014 - * Reverted to `Array.protype.foreach` loops. -* v3.0 - January 28, 2014 - * Switched to a data attribute for the toggle selector. - * Added namespacing to IIFE. - * Updated looping method and event listener. -* v2.19 - January 23, 2014 - * [Fix back button behavior in Chrome.](https://github.com/cferdinandi/smooth-scroll/issues/26#issuecomment-33172325) -* v2.18 - January 23, 2014 - * [Update URL before animation.](https://github.com/cferdinandi/smooth-scroll/pull/27) - * [Fix back button behavior in Firefox.](https://github.com/cferdinandi/smooth-scroll/issues/26) -* v2.17 - January 17, 2014 - * [Fixed back button behavior when using `data-url` feature.](https://github.com/cferdinandi/smooth-scroll/pull/18) -* v2.16 - January 16, 2014 - * [Updated variables for more accurate easing math when scrolling to top of page.](https://github.com/cferdinandi/smooth-scroll/pull/25#issuecomment-32566729) -* v2.15 - January 16, 2014 - * [Fixed bug that caused "scroll-to-top" animation to create endless loop.](https://github.com/cferdinandi/smooth-scroll/issues/24) -* v2.14 - January 15, 2014 - * [Fixed bug that caused animation to stop several pixels short.](https://github.com/cferdinandi/smooth-scroll/pull/15#issuecomment-32380770) -* v2.12 - January 7, 2014 - * [Added fixed header support.](https://github.com/cferdinandi/smooth-scroll/pull/20#issuecomment-31773547) -* v2.11 - January 4, 2014 - * [Change `offsetHeight` to `scrollHeight` to fix fixed/absolute positioning issues.](https://github.com/cferdinandi/smooth-scroll/pull/14) -* v2.10 - December 31, 2013 - * [Added URL history support.](https://github.com/cferdinandi/smooth-scroll/pull/17) -* v2.9 - December 9, 2013 - * [Added fixed for infinite loop when scrolling up.](https://github.com/cferdinandi/smooth-scroll/issues/13) -* v2.8 - December 3, 2013 - * [Fixed false distance reading.](https://github.com/cferdinandi/smooth-scroll/issues/11) - * Added linear easing as fallback when easing pattern not recognized to prevent script from failing. -* v2.7 - November 25, 2013 - * Converted naming conventions back to mathmatical roots (ex. `easeInCubic`) to remain consistent with development community language. -* v2.6 - November 26, 2013 - * Missing character was causing certain easing functions to break. -* v2.5 - November 22, 2013 - * Changed the default easing to `easeInOutNormal`. -* v2.4 - November 21, 2013 - * Added easing support with contributions from [Willem Liu](https://github.com/willemliu) and code from [Gaëtan Renaudeau](https://gist.github.com/gre/1650294). -* v2.3 - August 27, 2013 - * Added missing semicolons. - * Defined `animationStop` variable once, add values later. - * Activated strict mode. - * Wrapped in IIFE. -* v2.2 - August 17, 2013 - * Now you can set the animation speed with the `data-speed` attribute. (ex. `data-speed="400"`) -* v2.1 - August 17, 2013 - * Improvement animation function interval for smoother animation. - * Updated to allow for scrolling up the page. -* v2.0 - August 14, 2013 - * Converted to vanilla JavaScript. - * Removed dependency on jQuery. -* v1.1 - June 7, 2013 - * Switched to MIT license. -* v1.1 - May 18, 2013 - * Added jQuery noConflict mode. - * Updated tutorial. -* v1.0 - January 24, 2013 - * Initial release. - - - -## Older Docs - -* [Version 3](http://cferdinandi.github.io/smooth-scroll/archive/v3/) -* [Version 1](https://github.com/cferdinandi/smooth-scroll/tree/archive-v1) \ No newline at end of file diff --git a/scripts/smooth-scroll/dist/js/bind-polyfill.js b/scripts/smooth-scroll/dist/js/bind-polyfill.js deleted file mode 100755 index c4b8193..0000000 --- a/scripts/smooth-scroll/dist/js/bind-polyfill.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * smooth-scroll v5.1.2 - * Animate scrolling to anchor links, by Chris Ferdinandi. - * http://github.com/cferdinandi/smooth-scroll - * - * Free to use under the MIT License. - * http://gomakethings.com/mit/ - */ - -/* - * Polyfill Function.prototype.bind support for otherwise ECMA Script 5 compliant browsers - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Compatibility - */ - -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 - // internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1); - var fToBind = this; - fNOP = function () {}; - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} \ No newline at end of file diff --git a/scripts/smooth-scroll/dist/js/bind-polyfill.min.js b/scripts/smooth-scroll/dist/js/bind-polyfill.min.js deleted file mode 100755 index 0b18dfd..0000000 --- a/scripts/smooth-scroll/dist/js/bind-polyfill.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/** smooth-scroll v5.1.2, by Chris Ferdinandi | http://github.com/cferdinandi/smooth-scroll | Licensed under MIT: http://gomakethings.com/mit/ */ -Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var o=Array.prototype.slice.call(arguments,1),n=this;return fNOP=function(){},fBound=function(){return n.apply(this instanceof fNOP&&t?this:t,o.concat(Array.prototype.slice.call(arguments)))},fNOP.prototype=this.prototype,fBound.prototype=new fNOP,fBound}); \ No newline at end of file diff --git a/scripts/smooth-scroll/dist/js/smooth-scroll.js b/scripts/smooth-scroll/dist/js/smooth-scroll.js deleted file mode 100755 index d3407d5..0000000 --- a/scripts/smooth-scroll/dist/js/smooth-scroll.js +++ /dev/null @@ -1,393 +0,0 @@ -/** - * smooth-scroll v5.1.2 - * Animate scrolling to anchor links, by Chris Ferdinandi. - * http://github.com/cferdinandi/smooth-scroll - * - * Free to use under the MIT License. - * http://gomakethings.com/mit/ - */ - -(function (root, factory) { - if ( typeof define === 'function' && define.amd ) { - define('smoothScroll', factory(root)); - } else if ( typeof exports === 'object' ) { - module.exports = factory(root); - } else { - root.smoothScroll = factory(root); - } -})(this, function (root) { - - 'use strict'; - - // - // Variables - // - - var smoothScroll = {}; // Object for public APIs - var supports = !!document.querySelector && !!root.addEventListener; // Feature test - var settings; - - // Default settings - var defaults = { - speed: 500, - easing: 'easeInOutCubic', - offset: 0, - updateURL: true, - callbackBefore: function () {}, - callbackAfter: function () {} - }; - - - // - // Methods - // - - /** - * A simple forEach() implementation for Arrays, Objects and NodeLists - * @private - * @param {Array|Object|NodeList} collection Collection of items to iterate - * @param {Function} callback Callback function for each iteration - * @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`) - */ - var forEach = function (collection, callback, scope) { - if (Object.prototype.toString.call(collection) === '[object Object]') { - for (var prop in collection) { - if (Object.prototype.hasOwnProperty.call(collection, prop)) { - callback.call(scope, collection[prop], prop, collection); - } - } - } else { - for (var i = 0, len = collection.length; i < len; i++) { - callback.call(scope, collection[i], i, collection); - } - } - }; - - /** - * Merge defaults with user options - * @private - * @param {Object} defaults Default settings - * @param {Object} options User options - * @returns {Object} Merged values of defaults and options - */ - var extend = function ( defaults, options ) { - var extended = {}; - forEach(defaults, function (value, prop) { - extended[prop] = defaults[prop]; - }); - forEach(options, function (value, prop) { - extended[prop] = options[prop]; - }); - return extended; - }; - - /** - * Get the closest matching element up the DOM tree - * @param {Element} elem Starting element - * @param {String} selector Selector to match against (class, ID, or data attribute) - * @return {Boolean|Element} Returns false if not match found - */ - var getClosest = function (elem, selector) { - var firstChar = selector.charAt(0); - for ( ; elem && elem !== document; elem = elem.parentNode ) { - if ( firstChar === '.' ) { - if ( elem.classList.contains( selector.substr(1) ) ) { - return elem; - } - } else if ( firstChar === '#' ) { - if ( elem.id === selector.substr(1) ) { - return elem; - } - } else if ( firstChar === '[' ) { - if ( elem.hasAttribute( selector.substr(1, selector.length - 2) ) ) { - return elem; - } - } - } - return false; - }; - - /** - * Escape special characters for use with querySelector - * @private - * @param {String} id The anchor ID to escape - * @author Mathias Bynens - * @link https://github.com/mathiasbynens/CSS.escape - */ - var escapeCharacters = function ( id ) { - var string = String(id); - var length = string.length; - var index = -1; - var codeUnit; - var result = ''; - var firstCodeUnit = string.charCodeAt(0); - while (++index < length) { - codeUnit = string.charCodeAt(index); - // Note: there’s no need to special-case astral symbols, surrogate - // pairs, or lone surrogates. - - // If the character is NULL (U+0000), then throw an - // `InvalidCharacterError` exception and terminate these steps. - if (codeUnit === 0x0000) { - throw new InvalidCharacterError( - 'Invalid character: the input contains U+0000.' - ); - } - - if ( - // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is - // U+007F, […] - (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F || - // If the character is the first character and is in the range [0-9] - // (U+0030 to U+0039), […] - (index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) || - // If the character is the second character and is in the range [0-9] - // (U+0030 to U+0039) and the first character is a `-` (U+002D), […] - ( - index === 1 && - codeUnit >= 0x0030 && codeUnit <= 0x0039 && - firstCodeUnit === 0x002D - ) - ) { - // http://dev.w3.org/csswg/cssom/#escape-a-character-as-code-point - result += '\\' + codeUnit.toString(16) + ' '; - continue; - } - - // If the character is not handled by one of the above rules and is - // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or - // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to - // U+005A), or [a-z] (U+0061 to U+007A), […] - if ( - codeUnit >= 0x0080 || - codeUnit === 0x002D || - codeUnit === 0x005F || - codeUnit >= 0x0030 && codeUnit <= 0x0039 || - codeUnit >= 0x0041 && codeUnit <= 0x005A || - codeUnit >= 0x0061 && codeUnit <= 0x007A - ) { - // the character itself - result += string.charAt(index); - continue; - } - - // Otherwise, the escaped character. - // http://dev.w3.org/csswg/cssom/#escape-a-character - result += '\\' + string.charAt(index); - - } - return result; - }; - - /** - * Calculate the easing pattern - * @private - * @param {String} type Easing pattern - * @param {Number} time Time animation should take to complete - * @returns {Number} - */ - var easingPattern = function ( type, time ) { - var pattern; - if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity - if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity - if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration - if ( type === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity - if ( type === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity - if ( type === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration - if ( type === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration - if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration - return pattern || time; // no easing, no acceleration - }; - - /** - * Calculate how far to scroll - * @private - * @param {Element} anchor The anchor element to scroll to - * @param {Number} headerHeight Height of a fixed header, if any - * @param {Number} offset Number of pixels by which to offset scroll - * @returns {Number} - */ - var getEndLocation = function ( anchor, headerHeight, offset ) { - var location = 0; - if (anchor.offsetParent) { - do { - location += anchor.offsetTop; - anchor = anchor.offsetParent; - } while (anchor); - } - location = location - headerHeight - offset; - return location >= 0 ? location : 0; - }; - - /** - * Determine the document's height - * @private - * @returns {Number} - */ - var getDocumentHeight = function () { - return Math.max( - document.body.scrollHeight, document.documentElement.scrollHeight, - document.body.offsetHeight, document.documentElement.offsetHeight, - document.body.clientHeight, document.documentElement.clientHeight - ); - }; - - /** - * Convert data-options attribute into an object of key/value pairs - * @private - * @param {String} options Link-specific options as a data attribute string - * @returns {Object} - */ - var getDataOptions = function ( options ) { - return !options || !(typeof JSON === 'object' && typeof JSON.parse === 'function') ? {} : JSON.parse( options ); - }; - - /** - * Update the URL - * @private - * @param {Element} anchor The element to scroll to - * @param {Boolean} url Whether or not to update the URL history - */ - var updateUrl = function ( anchor, url ) { - if ( history.pushState && (url || url === 'true') ) { - history.pushState( { - pos: anchor.id - }, '', window.location.pathname + anchor ); - } - }; - - /** - * Start/stop the scrolling animation - * @public - * @param {Element} toggle The element that toggled the scroll event - * @param {Element} anchor The element to scroll to - * @param {Object} settings - * @param {Event} event - */ - smoothScroll.animateScroll = function ( toggle, anchor, options ) { - - // Options and overrides - var settings = extend( settings || defaults, options || {} ); // Merge user options with defaults - var overrides = getDataOptions( toggle ? toggle.getAttribute('data-options') : null ); - settings = extend( settings, overrides ); - anchor = '#' + escapeCharacters(anchor.substr(1)); // Escape special characters and leading numbers - - // Selectors and variables - var fixedHeader = document.querySelector('[data-scroll-header]'); // Get the fixed header - var headerHeight = fixedHeader === null ? 0 : (fixedHeader.offsetHeight + fixedHeader.offsetTop); // Get the height of a fixed header if one exists - var startLocation = root.pageYOffset; // Current location on the page - var endLocation = getEndLocation( document.querySelector(anchor), headerHeight, parseInt(settings.offset, 10) ); // Scroll to location - var animationInterval; // interval timer - var distance = endLocation - startLocation; // distance to travel - var documentHeight = getDocumentHeight(); - var timeLapsed = 0; - var percentage, position; - - // Update URL - updateUrl(anchor, settings.updateURL); - - /** - * Stop the scroll animation when it reaches its target (or the bottom/top of page) - * @private - * @param {Number} position Current position on the page - * @param {Number} endLocation Scroll to location - * @param {Number} animationInterval How much to scroll on this loop - */ - var stopAnimateScroll = function (position, endLocation, animationInterval) { - var currentLocation = root.pageYOffset; - if ( position == endLocation || currentLocation == endLocation || ( (root.innerHeight + currentLocation) >= documentHeight ) ) { - clearInterval(animationInterval); - settings.callbackAfter( toggle, anchor ); // Run callbacks after animation complete - } - }; - - /** - * Loop scrolling animation - * @private - */ - var loopAnimateScroll = function () { - timeLapsed += 16; - percentage = ( timeLapsed / parseInt(settings.speed, 10) ); - percentage = ( percentage > 1 ) ? 1 : percentage; - position = startLocation + ( distance * easingPattern(settings.easing, percentage) ); - root.scrollTo( 0, Math.floor(position) ); - stopAnimateScroll(position, endLocation, animationInterval); - }; - - /** - * Set interval timer - * @private - */ - var startAnimateScroll = function () { - settings.callbackBefore( toggle, anchor ); // Run callbacks before animating scroll - animationInterval = setInterval(loopAnimateScroll, 16); - }; - - /** - * Reset position to fix weird iOS bug - * @link https://github.com/cferdinandi/smooth-scroll/issues/45 - */ - if ( root.pageYOffset === 0 ) { - root.scrollTo( 0, 0 ); - } - - // Start scrolling animation - startAnimateScroll(); - - }; - - /** - * If smooth scroll element clicked, animate scroll - * @private - */ - var eventHandler = function (event) { - var toggle = getClosest(event.target, '[data-scroll]'); - if ( toggle && toggle.tagName.toLowerCase() === 'a' ) { - event.preventDefault(); // Prevent default click event - smoothScroll.animateScroll( toggle, toggle.hash, settings, event ); // Animate scroll - } - }; - - /** - * Destroy the current initialization. - * @public - */ - smoothScroll.destroy = function () { - if ( !settings ) return; - document.removeEventListener( 'click', eventHandler, false ); - settings = null; - }; - - /** - * Initialize Smooth Scroll - * @public - * @param {Object} options User settings - */ - smoothScroll.init = function ( options ) { - - // feature test - if ( !supports ) return; - - // Destroy any existing initializations - smoothScroll.destroy(); - - // Selectors and variables - settings = extend( defaults, options || {} ); // Merge user options with defaults - - // When a toggle is clicked, run the click handler - document.addEventListener('click', eventHandler, false); - - }; - - - // - // Public APIs - // - - return smoothScroll; - -}); diff --git a/scripts/smooth-scroll/dist/js/smooth-scroll.min.js b/scripts/smooth-scroll/dist/js/smooth-scroll.min.js deleted file mode 100755 index 9627a92..0000000 --- a/scripts/smooth-scroll/dist/js/smooth-scroll.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/** smooth-scroll v5.1.2, by Chris Ferdinandi | http://github.com/cferdinandi/smooth-scroll | Licensed under MIT: http://gomakethings.com/mit/ */ -!function(t,e){"function"==typeof define&&define.amd?define("smoothScroll",e(t)):"object"==typeof exports?module.exports=e(t):t.smoothScroll=e(t)}(this,function(t){"use strict";var e,n={},o=!!document.querySelector&&!!t.addEventListener,r={speed:500,easing:"easeInOutCubic",offset:0,updateURL:!0,callbackBefore:function(){},callbackAfter:function(){}},a=function(t,e,n){if("[object Object]"===Object.prototype.toString.call(t))for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(n,t[o],o,t);else for(var r=0,a=t.length;a>r;r++)e.call(n,t[r],r,t)},c=function(t,e){var n={};return a(t,function(e,o){n[o]=t[o]}),a(e,function(t,o){n[o]=e[o]}),n},u=function(t,e){for(var n=e.charAt(0);t&&t!==document;t=t.parentNode)if("."===n){if(t.classList.contains(e.substr(1)))return t}else if("#"===n){if(t.id===e.substr(1))return t}else if("["===n&&t.hasAttribute(e.substr(1,e.length-2)))return t;return!1},i=function(t){for(var e,n=String(t),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r=1&&31>=e||127==e||0===r&&e>=48&&57>=e||1===r&&e>=48&&57>=e&&45===c?"\\"+e.toString(16)+" ":e>=128||45===e||95===e||e>=48&&57>=e||e>=65&&90>=e||e>=97&&122>=e?n.charAt(r):"\\"+n.charAt(r)}return a},s=function(t,e){var n;return"easeInQuad"===t&&(n=e*e),"easeOutQuad"===t&&(n=e*(2-e)),"easeInOutQuad"===t&&(n=.5>e?2*e*e:-1+(4-2*e)*e),"easeInCubic"===t&&(n=e*e*e),"easeOutCubic"===t&&(n=--e*e*e+1),"easeInOutCubic"===t&&(n=.5>e?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1),"easeInQuart"===t&&(n=e*e*e*e),"easeOutQuart"===t&&(n=1- --e*e*e*e),"easeInOutQuart"===t&&(n=.5>e?8*e*e*e*e:1-8*--e*e*e*e),"easeInQuint"===t&&(n=e*e*e*e*e),"easeOutQuint"===t&&(n=1+--e*e*e*e*e),"easeInOutQuint"===t&&(n=.5>e?16*e*e*e*e*e:1+16*--e*e*e*e*e),n||e},f=function(t,e,n){var o=0;if(t.offsetParent)do o+=t.offsetTop,t=t.offsetParent;while(t);return o=o-e-n,o>=0?o:0},l=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},d=function(t){return t&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(t):{}},h=function(t,e){history.pushState&&(e||"true"===e)&&history.pushState({pos:t.id},"",window.location.pathname+t)};n.animateScroll=function(e,n,o){var a=c(a||r,o||{}),u=d(e?e.getAttribute("data-options"):null);a=c(a,u),n="#"+i(n.substr(1));var p,m,b,v=document.querySelector("[data-scroll-header]"),g=null===v?0:v.offsetHeight+v.offsetTop,O=t.pageYOffset,y=f(document.querySelector(n),g,parseInt(a.offset,10)),I=y-O,S=l(),A=0;h(n,a.updateURL);var Q=function(o,r,c){var u=t.pageYOffset;(o==r||u==r||t.innerHeight+u>=S)&&(clearInterval(c),a.callbackAfter(e,n))},C=function(){A+=16,m=A/parseInt(a.speed,10),m=m>1?1:m,b=O+I*s(a.easing,m),t.scrollTo(0,Math.floor(b)),Q(b,y,p)},H=function(){a.callbackBefore(e,n),p=setInterval(C,16)};0===t.pageYOffset&&t.scrollTo(0,0),H()};var p=function(t){var o=u(t.target,"[data-scroll]");o&&"a"===o.tagName.toLowerCase()&&(t.preventDefault(),n.animateScroll(o,o.hash,e,t))};return n.destroy=function(){e&&(document.removeEventListener("click",p,!1),e=null)},n.init=function(t){o&&(n.destroy(),e=c(r,t||{}),document.addEventListener("click",p,!1))},n}); \ No newline at end of file diff --git a/scripts/smooth-scroll/gulpfile.js b/scripts/smooth-scroll/gulpfile.js deleted file mode 100755 index 2e47bd4..0000000 --- a/scripts/smooth-scroll/gulpfile.js +++ /dev/null @@ -1,156 +0,0 @@ -// Gulp Packages -var gulp = require('gulp'); -var plumber = require('gulp-plumber'); -var clean = require('gulp-clean'); -var rename = require('gulp-rename'); -var flatten = require('gulp-flatten'); -var tap = require('gulp-tap'); -var header = require('gulp-header'); -var jshint = require('gulp-jshint'); -var stylish = require('jshint-stylish'); -var concat = require('gulp-concat'); -var uglify = require('gulp-uglify'); -var sass = require('gulp-ruby-sass'); -var prefix = require('gulp-autoprefixer'); -var minify = require('gulp-minify-css'); -var karma = require('gulp-karma'); -var package = require('./package.json'); - -// Paths to project folders -var paths = { - output : 'dist/', - temp: 'src/temp/', - scripts : { - input : [ 'src/js/*' ], - output : 'dist/js/' - }, - styles : { - input : 'src/sass/**/*.scss', - output : 'dist/css/' - }, - static : 'src/static/**', - test : { - spec : [ 'test/spec/**/*.js' ], - coverage: 'test/coverage/', - results: 'test/results/' - } -}; - -// Template for banner to add to file headers -var banner = { - full : - '/**\n' + - ' * <%= package.name %> v<%= package.version %>\n' + - ' * <%= package.description %>, by <%= package.author.name %>.\n' + - ' * <%= package.repository.url %>\n' + - ' * \n' + - ' * Free to use under the MIT License.\n' + - ' * http://gomakethings.com/mit/\n' + - ' */\n\n', - min : - '/**' + - ' <%= package.name %> v<%= package.version %>, by Chris Ferdinandi' + - ' | <%= package.repository.url %>' + - ' | Licensed under MIT: http://gomakethings.com/mit/' + - ' */\n' -}; - -// Concatenate scripts in subfolders -gulp.task('concatenate', function() { - return gulp.src(paths.scripts.input) - .pipe(plumber()) - .pipe(flatten()) - - .pipe(tap(function (file, t) { - if ( file.stat.isDirectory() ) { - var name = file.relative + '.js'; - return gulp.src(file.path + '/*.js') - .pipe(concat(name)) - .pipe(gulp.dest(paths.temp)); - } - })); -}); - -// Lint and minify scripts -gulp.task('scripts', ['clean', 'concatenate'], function() { - return gulp.src([ - paths.scripts.input + '/../*.js', - paths.temp + '/*.js' - ]) - .pipe(plumber()) - .pipe(flatten()) - .pipe(header(banner.full, { package : package })) - .pipe(gulp.dest(paths.scripts.output)) - .pipe(rename({ suffix: '.min' })) - .pipe(uglify()) - .pipe(header(banner.min, { package : package })) - .pipe(gulp.dest(paths.scripts.output)); -}); - -// Process, lint, and minify Sass files -gulp.task('styles', ['clean'], function() { - return gulp.src(paths.styles.input) - .pipe(plumber()) - .pipe(sass({style: 'expanded', noCache: true})) - .pipe(flatten()) - .pipe(prefix('last 2 version', '> 1%')) - .pipe(header(banner.full, { package : package })) - .pipe(gulp.dest(paths.styles.output)) - .pipe(rename({ suffix: '.min' })) - .pipe(minify()) - .pipe(header(banner.min, { package : package })) - .pipe(gulp.dest(paths.styles.output)); -}); - -// Copy static files into output folder -gulp.task('static', ['clean'], function() { - return gulp.src(paths.static) - .pipe(plumber()) - .pipe(gulp.dest(paths.output)); -}); - -// Lint scripts -gulp.task('lint', function () { - return gulp.src(paths.scripts.input) - .pipe(plumber()) - .pipe(jshint()) - .pipe(jshint.reporter('jshint-stylish')); -}); - -// Remove prexisting content from output and test folders -gulp.task('clean', function () { - return gulp.src([ - paths.output, - paths.test.coverage, - paths.test.results - ], { read: false }) - .pipe(plumber()) - .pipe(clean()); -}); - -// Remove temporary files -gulp.task('cleanTemp', ['scripts'], function () { - return gulp.src(paths.temp, { read: false }) - .pipe(plumber()) - .pipe(clean()); -}); - -// Run unit tests -gulp.task('test', function() { - return gulp.src([paths.scripts.input + '/../**/*.js'].concat(paths.test.spec)) - .pipe(plumber()) - .pipe(karma({ configFile: 'test/karma.conf.js' })) - .on('error', function(err) { throw err; }); -}); - -// Combine tasks into runner -gulp.task('default', [ - 'lint', - 'clean', - 'static', - 'concatenate', - 'scripts', - 'styles', - 'cleanTemp', - 'test' -]); \ No newline at end of file diff --git a/scripts/smooth-scroll/index.html b/scripts/smooth-scroll/index.html deleted file mode 100755 index 459ca3e..0000000 --- a/scripts/smooth-scroll/index.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - Smooth Scroll - - - - - - - -
- -

Smooth Scroll

-

A lightweight script to animate scrolling to anchor links.

-

Smooth Scroll on GitHub

- -

- -

- Linear
- Linear (no other options)
-

- -

- Ease-In
- Quad
- Cubic
- Quart
- Quint -

- -

- Ease-In-Out
- Quad
- Cubic
- Quart
- Quint -

- -

- Ease-Out
- Quad
- Cubic
- Quart
- Quint -

- -

- .
.
.
.
.
.
.
.
.
.
.
.
.
- .
.
.
.
.
.
.
.
.
.
.
.
.
- .
.
.
.
.
.
.
.
.
.
.
.
. -

- -

Bazinga!

- -

- .
.
.
.
.
.
.
.
.
.
.
.
.
- .
.
.
.
.
.
.
.
.
.
.
.
.
- .
.
.
.
.
.
.
.
.
.
.
.
. -

- -

Back to the top

- -
- - - - - - - - - diff --git a/scripts/smooth-scroll/package.json b/scripts/smooth-scroll/package.json deleted file mode 100755 index 0372095..0000000 --- a/scripts/smooth-scroll/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "smooth-scroll", - "version": "5.1.2", - "description": "Animate scrolling to anchor links", - "author": { - "name": "Chris Ferdinandi", - "url": "http://gomakethings.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "http://github.com/cferdinandi/smooth-scroll" - }, - "devDependencies": { - "gulp": "~3.8.0", - "gulp-autoprefixer": "0.0.7", - "gulp-clean": "^0.2.4", - "gulp-concat": "~2.2.0", - "gulp-flatten": "~0.0.2", - "gulp-tap": "~0.1.1", - "gulp-header": "^1.0.2", - "gulp-jshint": "^1.6.1", - "gulp-karma": "0.0.4", - "gulp-minify-css": "~0.3.4", - "gulp-plumber": "~0.6.2", - "gulp-rename": "~1.1.0", - "gulp-ruby-sass": "~0.7.1", - "gulp-uglify": "~0.3.0", - "jshint-stylish": "^0.2.0", - "karma": "^0.12.16", - "karma-coverage": "^0.2.4", - "karma-jasmine": "~0.2.0", - "karma-phantomjs-launcher": "^0.1.4", - "karma-spec-reporter": "0.0.13", - "karma-htmlfile-reporter": "~0.1" - } -} diff --git a/scripts/smooth-scroll/src/js/bind-polyfill.js b/scripts/smooth-scroll/src/js/bind-polyfill.js deleted file mode 100755 index e6a8f6b..0000000 --- a/scripts/smooth-scroll/src/js/bind-polyfill.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Polyfill Function.prototype.bind support for otherwise ECMA Script 5 compliant browsers - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Compatibility - */ - -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 - // internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1); - var fToBind = this; - fNOP = function () {}; - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} \ No newline at end of file diff --git a/scripts/smooth-scroll/src/js/smooth-scroll.js b/scripts/smooth-scroll/src/js/smooth-scroll.js deleted file mode 100755 index d0424ad..0000000 --- a/scripts/smooth-scroll/src/js/smooth-scroll.js +++ /dev/null @@ -1,384 +0,0 @@ -(function (root, factory) { - if ( typeof define === 'function' && define.amd ) { - define('smoothScroll', factory(root)); - } else if ( typeof exports === 'object' ) { - module.exports = factory(root); - } else { - root.smoothScroll = factory(root); - } -})(this, function (root) { - - 'use strict'; - - // - // Variables - // - - var smoothScroll = {}; // Object for public APIs - var supports = !!document.querySelector && !!root.addEventListener; // Feature test - var settings; - - // Default settings - var defaults = { - speed: 500, - easing: 'easeInOutCubic', - offset: 0, - updateURL: true, - callbackBefore: function () {}, - callbackAfter: function () {} - }; - - - // - // Methods - // - - /** - * A simple forEach() implementation for Arrays, Objects and NodeLists - * @private - * @param {Array|Object|NodeList} collection Collection of items to iterate - * @param {Function} callback Callback function for each iteration - * @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`) - */ - var forEach = function (collection, callback, scope) { - if (Object.prototype.toString.call(collection) === '[object Object]') { - for (var prop in collection) { - if (Object.prototype.hasOwnProperty.call(collection, prop)) { - callback.call(scope, collection[prop], prop, collection); - } - } - } else { - for (var i = 0, len = collection.length; i < len; i++) { - callback.call(scope, collection[i], i, collection); - } - } - }; - - /** - * Merge defaults with user options - * @private - * @param {Object} defaults Default settings - * @param {Object} options User options - * @returns {Object} Merged values of defaults and options - */ - var extend = function ( defaults, options ) { - var extended = {}; - forEach(defaults, function (value, prop) { - extended[prop] = defaults[prop]; - }); - forEach(options, function (value, prop) { - extended[prop] = options[prop]; - }); - return extended; - }; - - /** - * Get the closest matching element up the DOM tree - * @param {Element} elem Starting element - * @param {String} selector Selector to match against (class, ID, or data attribute) - * @return {Boolean|Element} Returns false if not match found - */ - var getClosest = function (elem, selector) { - var firstChar = selector.charAt(0); - for ( ; elem && elem !== document; elem = elem.parentNode ) { - if ( firstChar === '.' ) { - if ( elem.classList.contains( selector.substr(1) ) ) { - return elem; - } - } else if ( firstChar === '#' ) { - if ( elem.id === selector.substr(1) ) { - return elem; - } - } else if ( firstChar === '[' ) { - if ( elem.hasAttribute( selector.substr(1, selector.length - 2) ) ) { - return elem; - } - } - } - return false; - }; - - /** - * Escape special characters for use with querySelector - * @private - * @param {String} id The anchor ID to escape - * @author Mathias Bynens - * @link https://github.com/mathiasbynens/CSS.escape - */ - var escapeCharacters = function ( id ) { - var string = String(id); - var length = string.length; - var index = -1; - var codeUnit; - var result = ''; - var firstCodeUnit = string.charCodeAt(0); - while (++index < length) { - codeUnit = string.charCodeAt(index); - // Note: there’s no need to special-case astral symbols, surrogate - // pairs, or lone surrogates. - - // If the character is NULL (U+0000), then throw an - // `InvalidCharacterError` exception and terminate these steps. - if (codeUnit === 0x0000) { - throw new InvalidCharacterError( - 'Invalid character: the input contains U+0000.' - ); - } - - if ( - // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is - // U+007F, […] - (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F || - // If the character is the first character and is in the range [0-9] - // (U+0030 to U+0039), […] - (index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) || - // If the character is the second character and is in the range [0-9] - // (U+0030 to U+0039) and the first character is a `-` (U+002D), […] - ( - index === 1 && - codeUnit >= 0x0030 && codeUnit <= 0x0039 && - firstCodeUnit === 0x002D - ) - ) { - // http://dev.w3.org/csswg/cssom/#escape-a-character-as-code-point - result += '\\' + codeUnit.toString(16) + ' '; - continue; - } - - // If the character is not handled by one of the above rules and is - // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or - // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to - // U+005A), or [a-z] (U+0061 to U+007A), […] - if ( - codeUnit >= 0x0080 || - codeUnit === 0x002D || - codeUnit === 0x005F || - codeUnit >= 0x0030 && codeUnit <= 0x0039 || - codeUnit >= 0x0041 && codeUnit <= 0x005A || - codeUnit >= 0x0061 && codeUnit <= 0x007A - ) { - // the character itself - result += string.charAt(index); - continue; - } - - // Otherwise, the escaped character. - // http://dev.w3.org/csswg/cssom/#escape-a-character - result += '\\' + string.charAt(index); - - } - return result; - }; - - /** - * Calculate the easing pattern - * @private - * @param {String} type Easing pattern - * @param {Number} time Time animation should take to complete - * @returns {Number} - */ - var easingPattern = function ( type, time ) { - var pattern; - if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity - if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity - if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration - if ( type === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity - if ( type === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity - if ( type === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration - if ( type === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration - if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity - if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity - if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration - return pattern || time; // no easing, no acceleration - }; - - /** - * Calculate how far to scroll - * @private - * @param {Element} anchor The anchor element to scroll to - * @param {Number} headerHeight Height of a fixed header, if any - * @param {Number} offset Number of pixels by which to offset scroll - * @returns {Number} - */ - var getEndLocation = function ( anchor, headerHeight, offset ) { - var location = 0; - if (anchor.offsetParent) { - do { - location += anchor.offsetTop; - anchor = anchor.offsetParent; - } while (anchor); - } - location = location - headerHeight - offset; - return location >= 0 ? location : 0; - }; - - /** - * Determine the document's height - * @private - * @returns {Number} - */ - var getDocumentHeight = function () { - return Math.max( - document.body.scrollHeight, document.documentElement.scrollHeight, - document.body.offsetHeight, document.documentElement.offsetHeight, - document.body.clientHeight, document.documentElement.clientHeight - ); - }; - - /** - * Convert data-options attribute into an object of key/value pairs - * @private - * @param {String} options Link-specific options as a data attribute string - * @returns {Object} - */ - var getDataOptions = function ( options ) { - return !options || !(typeof JSON === 'object' && typeof JSON.parse === 'function') ? {} : JSON.parse( options ); - }; - - /** - * Update the URL - * @private - * @param {Element} anchor The element to scroll to - * @param {Boolean} url Whether or not to update the URL history - */ - var updateUrl = function ( anchor, url ) { - if ( history.pushState && (url || url === 'true') ) { - history.pushState( { - pos: anchor.id - }, '', window.location.pathname + anchor ); - } - }; - - /** - * Start/stop the scrolling animation - * @public - * @param {Element} toggle The element that toggled the scroll event - * @param {Element} anchor The element to scroll to - * @param {Object} settings - * @param {Event} event - */ - smoothScroll.animateScroll = function ( toggle, anchor, options ) { - - // Options and overrides - var settings = extend( settings || defaults, options || {} ); // Merge user options with defaults - var overrides = getDataOptions( toggle ? toggle.getAttribute('data-options') : null ); - settings = extend( settings, overrides ); - anchor = '#' + escapeCharacters(anchor.substr(1)); // Escape special characters and leading numbers - - // Selectors and variables - var fixedHeader = document.querySelector('[data-scroll-header]'); // Get the fixed header - var headerHeight = fixedHeader === null ? 0 : (fixedHeader.offsetHeight + fixedHeader.offsetTop); // Get the height of a fixed header if one exists - var startLocation = root.pageYOffset; // Current location on the page - var endLocation = getEndLocation( document.querySelector(anchor), headerHeight, parseInt(settings.offset, 10) ); // Scroll to location - var animationInterval; // interval timer - var distance = endLocation - startLocation; // distance to travel - var documentHeight = getDocumentHeight(); - var timeLapsed = 0; - var percentage, position; - - // Update URL - updateUrl(anchor, settings.updateURL); - - /** - * Stop the scroll animation when it reaches its target (or the bottom/top of page) - * @private - * @param {Number} position Current position on the page - * @param {Number} endLocation Scroll to location - * @param {Number} animationInterval How much to scroll on this loop - */ - var stopAnimateScroll = function (position, endLocation, animationInterval) { - var currentLocation = root.pageYOffset; - if ( position == endLocation || currentLocation == endLocation || ( (root.innerHeight + currentLocation) >= documentHeight ) ) { - clearInterval(animationInterval); - settings.callbackAfter( toggle, anchor ); // Run callbacks after animation complete - } - }; - - /** - * Loop scrolling animation - * @private - */ - var loopAnimateScroll = function () { - timeLapsed += 16; - percentage = ( timeLapsed / parseInt(settings.speed, 10) ); - percentage = ( percentage > 1 ) ? 1 : percentage; - position = startLocation + ( distance * easingPattern(settings.easing, percentage) ); - root.scrollTo( 0, Math.floor(position) ); - stopAnimateScroll(position, endLocation, animationInterval); - }; - - /** - * Set interval timer - * @private - */ - var startAnimateScroll = function () { - settings.callbackBefore( toggle, anchor ); // Run callbacks before animating scroll - animationInterval = setInterval(loopAnimateScroll, 16); - }; - - /** - * Reset position to fix weird iOS bug - * @link https://github.com/cferdinandi/smooth-scroll/issues/45 - */ - if ( root.pageYOffset === 0 ) { - root.scrollTo( 0, 0 ); - } - - // Start scrolling animation - startAnimateScroll(); - - }; - - /** - * If smooth scroll element clicked, animate scroll - * @private - */ - var eventHandler = function (event) { - var toggle = getClosest(event.target, '[data-scroll]'); - if ( toggle && toggle.tagName.toLowerCase() === 'a' ) { - event.preventDefault(); // Prevent default click event - smoothScroll.animateScroll( toggle, toggle.hash, settings, event ); // Animate scroll - } - }; - - /** - * Destroy the current initialization. - * @public - */ - smoothScroll.destroy = function () { - if ( !settings ) return; - document.removeEventListener( 'click', eventHandler, false ); - settings = null; - }; - - /** - * Initialize Smooth Scroll - * @public - * @param {Object} options User settings - */ - smoothScroll.init = function ( options ) { - - // feature test - if ( !supports ) return; - - // Destroy any existing initializations - smoothScroll.destroy(); - - // Selectors and variables - settings = extend( defaults, options || {} ); // Merge user options with defaults - - // When a toggle is clicked, run the click handler - document.addEventListener('click', eventHandler, false); - - }; - - - // - // Public APIs - // - - return smoothScroll; - -}); diff --git a/scripts/smooth-scroll/test/karma.conf.js b/scripts/smooth-scroll/test/karma.conf.js deleted file mode 100755 index c140e5e..0000000 --- a/scripts/smooth-scroll/test/karma.conf.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = function (config) { - config.set({ - basePath : '', - autoWatch : true, - frameworks: ['jasmine'], - browsers : ['PhantomJS'], - plugins : [ - 'karma-spec-reporter', - 'karma-phantomjs-launcher', - 'karma-jasmine', - 'karma-coverage', - 'karma-htmlfile-reporter' - ], - reporters : ['spec', 'coverage', 'html'], - preprocessors: { - '../src/js/**/*.js': 'coverage' - }, - coverageReporter: { - type : 'html', - dir : 'coverage/' - }, - htmlReporter: { - outputFile: 'results/unit-tests.html' - } - }); -}; \ No newline at end of file diff --git a/scripts/smooth-scroll/test/spec/spec-smoothScroll.js b/scripts/smooth-scroll/test/spec/spec-smoothScroll.js deleted file mode 100755 index 88569d2..0000000 --- a/scripts/smooth-scroll/test/spec/spec-smoothScroll.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('Smooth Scroll', function () { - - describe('init', function () { - it('should include the smoothScroll module', function () { - expect(!!smoothScroll).toBe(true); - }); - }); - -});