Skip to content

Commit

Permalink
Css tweaks & AMD support
Browse files Browse the repository at this point in the history
  • Loading branch information
kenwheeler committed Mar 27, 2014
1 parent 9f57103 commit d35982a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 67 deletions.
8 changes: 5 additions & 3 deletions css/slick.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@

.slick-slider { position: relative; display: block; margin-bottom: 30px;}
.slick-slider .slick-list { overflow: hidden; display: block; margin: 0px; padding: 0px; }
.slick-slider .slick-track { position: relative; left: 0px; top: 0px; }
.slick-slider .slide { float: left; min-height: 1px; }
.slick-slider .slick-track { position: relative; left: 0px; top: 0px; display: table;}
.slick-slider .slick-track:after { content: ""; display: table; clear: both; }
.slick-slider .slide { float: left; height: 100%; min-height: 1px; }
.slick-slider .slide img { display: block; }
.slick-slider .slide { display: none; }
.slick-initialized .slide { display: block; }
.slick-initialized .slide { display: table-cell; }

/* Loading States */

.slick-loading .slick-track { visibility: hidden; }
.slick-loading .slick-list { background: #fff url(../img/ajax-loader.gif) center center no-repeat; }
.slick-loading .slide { visibility: hidden; }
.slide.loading { background: url(../img/ajax-loader.gif) center center no-repeat; position: relative;}

/* Arrows */

Expand Down
47 changes: 16 additions & 31 deletions js/slick.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
// Slick
/*
slick.js
Author: Ken Wheeler
Date: 03/23/14
Version: 1.0
*/

/*global window, document, $, setInterval, clearInterval */

(function (factory) {

if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
factory(jQuery);
}

}(function ($) {

var slick = window.slick || {};

/************ Helpers ***********/
Expand All @@ -35,31 +43,6 @@ var mobileDetect = function() {
return check;
};

// Helpers

function throttle(fn, threshhold, scope) {
threshhold || (threshhold = 250);
var last,
deferTimer;
return function() {
var context = scope || this;

var now = +new Date,
args = arguments;
if (last && now < last + threshhold) {
// hold on to it
clearTimeout(deferTimer);
deferTimer = setTimeout(function() {
last = now;
fn.apply(context, args);
}, threshhold);
} else {
last = now;
fn.apply(context, args);
}
};
}

/********** End Helpers *********/

slick.slider = (function() {
Expand Down Expand Up @@ -478,15 +461,15 @@ var mobileDetect = function() {

this.list.on('touchstart', {
action: 'start'
}, throttle(this.swipeHandler, 20));
}, this.swipeHandler);

this.list.on('touchmove', {
action: 'move'
}, throttle(this.swipeHandler, 20));
}, this.swipeHandler);

this.list.on('touchend', {
action: 'end'
}, throttle(this.swipeHandler, 20));
}, this.swipeHandler);

}

Expand Down Expand Up @@ -1101,4 +1084,6 @@ $.fn.unslick = function(){
this.slider.destroy();

});
}
}

}));
Loading

0 comments on commit d35982a

Please sign in to comment.