@@ -84,20 +43,27 @@
Smoothslides
+
+
+
+
+
+
Download & Docs
+
diff --git a/js/smoothslides.js b/js/smoothslides.js
index cd03f16..30cf20b 100644
--- a/js/smoothslides.js
+++ b/js/smoothslides.js
@@ -2,8 +2,8 @@
* Smoothslides
* http://kthornbloom.com/smoothslides.php
*
- * Copyright 2013, Kevin Thornbloom
- * Free to use and abuse under the MIT license.
+ * Copyright 2014, Kevin Thornbloom
+ * Free to use and modify under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
@@ -13,20 +13,21 @@
// These are overridden by options declared in footer
var defaults = {
- playTimer: 3000,
+ playTimer: 6000,
animEasing: 'ease-in-out',
autoanimType: 'random',
- nextText: '›',
- prevText: '‹',
+ nextText: ' ►',
+ prevText: '◄ ',
captions: 'true',
navigation: 'true',
- pagination: 'true'
+ pagination: 'true',
+ order: 'normal'
}
var options = $.extend(defaults, options),
convertSeconds = (options.playTimer / 1000) - .5
- /* Set CSS transition timing and easing */
+ /* Set CSS transition timing and easing */
$('.ss-slide').css({
'webkitTransition': 'all ' + convertSeconds + 's ' + options.animEasing,
'mozTransition': 'all ' + convertSeconds + 's ' + options.animEasing,
@@ -34,27 +35,55 @@
'oTransition': 'all ' + convertSeconds + 's ' + options.animEasing,
'transition': 'all ' + convertSeconds + 's ' + options.animEasing
});
-
+ // Set some inline styles & add markup
$('.ss-slide:last').css('position', 'relative');
$('.ss-slides').wrap('
');
+
+ // Randomizer Function
+ $.fn.randomize = function(selector){
+ (selector ? this.find(selector) : this).parent().each(function(){
+ $(this).children(selector).sort(function(){
+ return Math.random() - 0.5;
+ }).detach().appendTo(this);
+ });
+
+ return this;
+ };
+
+ // Add Captions
if (options.captions == 'true') {
$('.ss-slides-wrap').append('
');
}
var caption = $('.ss-slide:last').attr('title');
$('.ss-caption').html(caption);
+ // Add Pagination
if (options.pagination == 'true') {
$('.ss-slides-wrap').append('
');
$('.ss-slide').each(function () {
$('.ss-paginate').append('
');
});
- $('.ss-paginate a:first').addClass('ss-current');
+ $('.ss-paginate a:last').addClass('ss-current');
}
+
+ // Add Navigation
if (options.navigation == 'true') {
$('.ss-slides-wrap').append('
' + options.prevText + '' + options.nextText + '');
}
+ // Order
+ if (options.order == 'normal') {
+ $('.ss-slide').each(function() {
+ $(this).prependTo(this.parentNode);
+ });
+ $('.ss-slide:first').appendTo('.ss-slides');
+ } else if (options.order == 'random') {
+ $('.ss-slide').randomize();
+ } else if (options.order == 'reverse') {
+ $('.ss-slide:first').appendTo('.ss-slides');
+ }
+ // Update Caption function
function captionUpdater() {
if ($('.ss-slide:eq(-2)').attr('title')) {
var caption = $('.ss-slide:eq(-2)').attr('title');
@@ -66,6 +95,7 @@
}
}
+ // Update Pagination forwards
function paginateForwards() {
var currentDot = ($('.ss-current').index()) + 1,
nextSlide = currentDot + 1,
@@ -79,6 +109,7 @@
}
}
+ // Updated Pagination reverse
function paginateBackwards() {
var currentDot = ($('.ss-current').index()) + 1,
nextSlide = currentDot - 2,
@@ -92,6 +123,10 @@
}
}
+ /* ======================= */
+ //Effects
+ /* ======================= */
+
function crossFade() {
captionUpdater();
paginateForwards();
@@ -237,14 +272,14 @@
});
}
- /* Start First Animation */
+ // Start First Animation
if (options.autoanimType == 'random') {
var fns = [zoomOut, zoomIn, panRight, panLeft];
fns[Math.floor(Math.random() * fns.length)]();
} else if (options.autoanimType == 'false') {
//
} else {
- eval(options.autoanimType + "()");
+ eval(options.autoanimType + "()");
}
/* Subsequent Auto Animations */
@@ -326,7 +361,8 @@
$('.ss-slide:last').prependTo('.ss-slides').removeClass('notrans').css({
'webkitTransform': 'scale(1) rotate(0deg)',
'msTransform': 'scale(1) rotate(0deg)',
- 'transform': 'scale(1) rotate(0deg)'
+ 'transform': 'scale(1) rotate(0deg)',
+ 'display':'none'
}).show();
$('.ss-current').removeClass();
$('.ss-paginate a').eq(whichClicked-1).addClass('ss-current');
diff --git a/js/smoothslides.min.js b/js/smoothslides.min.js
index 86c5658..3b0761d 100644
--- a/js/smoothslides.min.js
+++ b/js/smoothslides.min.js
@@ -1 +1 @@
-(function($){$.fn.extend({smoothSlides:function(options){function captionUpdater(){if($(".ss-slide:eq(-2)").attr("title")){var e=$(".ss-slide:eq(-2)").attr("title");$(".ss-caption").html(e).fadeIn(500)}else{$(".ss-caption").fadeOut(500,function(){$(".ss-caption").empty()})}}function paginateForwards(){var e=$(".ss-current").index()+1,t=e+1,n=$(".ss-paginate a").length;if(e>=n){$(".ss-current").removeClass("ss-current");$(".ss-paginate a:first").addClass("ss-current")}else{$(".ss-current").removeClass("ss-current");$(".ss-paginate a").eq(e).addClass("ss-current")}}function paginateBackwards(){var e=$(".ss-current").index()+1,t=e-2,n=$(".ss-paginate a").length;if(e<=1){$(".ss-current").removeClass("ss-current");$(".ss-paginate a:last").addClass("ss-current")}else{$(".ss-current").removeClass("ss-current");$(".ss-paginate a").eq(t).addClass("ss-current")}}function crossFade(){captionUpdater();paginateForwards();$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)",opacity:"0"}).show();$(".ss-slide:first").css({opacity:"1"})})}function zoomIn(){captionUpdater();paginateForwards();$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").css({webkitTransform:"scale(1.2) rotate(2deg)",msTransform:"scale(1.2) rotate(2deg)",transform:"scale(1.2) rotate(2deg)"})})}function zoomOut(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.2) rotate(2deg)",msTransform:"scale(1.2) rotate(2deg)",transform:"scale(1.2) rotate(2deg)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"})})}function panRight(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(-10%, 0)",msTransform:"scale(1.3) translate(-10%, 0)",transform:"scale(1.3) translate(-10%, 0)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}function panLeft(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(10%, 0)",msTransform:"scale(1.3) translate(10%, 0)",transform:"scale(1.3) translate(10%, 0)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}function panUp(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(0, 10%)",msTransform:"scale(1.3) translate(0, 10%)",transform:"scale(1.3) translate(0, 10%)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}function panDown(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(0, -10%)",msTransform:"scale(1.3) translate(0, -10%)",transform:"scale(1.3) translate(0, -10%)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}var defaults={playTimer:3e3,animEasing:"ease-in-out",autoanimType:"random",nextText:"›",prevText:"‹",captions:"true",navigation:"true",pagination:"true"};var options=$.extend(defaults,options),convertSeconds=options.playTimer/1e3-.5;$(".ss-slide").css({webkitTransition:"all "+convertSeconds+"s "+options.animEasing,mozTransition:"all "+convertSeconds+"s "+options.animEasing,msTransition:"all "+convertSeconds+"s "+options.animEasing,oTransition:"all "+convertSeconds+"s "+options.animEasing,transition:"all "+convertSeconds+"s "+options.animEasing});$(".ss-slide:last").css("position","relative");$(".ss-slides").wrap('
');if(options.captions=="true"){$(".ss-slides-wrap").append('
')}var caption=$(".ss-slide:last").attr("title");$(".ss-caption").html(caption);if(options.pagination=="true"){$(".ss-slides-wrap").append('
');$(".ss-slide").each(function(){$(".ss-paginate").append('
')});$(".ss-paginate a:first").addClass("ss-current")}if(options.navigation=="true"){$(".ss-slides-wrap").append('
'+options.prevText+''+options.nextText+"")}if(options.autoanimType=="random"){var fns=[zoomOut,zoomIn,panRight,panLeft];fns[Math.floor(Math.random()*fns.length)]()}else if(options.autoanimType=="false"){}else{eval(options.autoanimType+"()")}var fn=function(){if(options.autoanimType=="random"){var fns=[zoomOut,zoomIn,panRight,panLeft,panUp,panDown];fns[Math.floor(Math.random()*fns.length)]()}else if(options.autoanimType=="false"){}else{eval(options.autoanimType+"()")}};var myInterval=setInterval(fn,options.playTimer);$("#ss-prev, #ss-next, .ss-paginate").hover(function(e){clearInterval(myInterval)},function(e){myInterval=setInterval(fn,options.playTimer)});var quickNext=function(){$("#ss-next").off("click");$(".ss-slide:last").addClass("notrans").fadeOut("250",function(){$(".ss-slide:last").prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)",opacity:"1"}).show();$("#ss-next").on("click",quickNext)});captionUpdater();paginateForwards();event.preventDefault()};$("#ss-next").on("click",quickNext);var quickPrev=function(){$("#ss-prev").off("click");if($(".ss-slide:first").attr("title")){var e=$(".ss-slide:first").attr("title");$(".ss-caption").html(e).show()}else{$(".ss-caption").empty().hide()}paginateBackwards();$(".ss-slide:first").hide().addClass("notrans").appendTo(".ss-slides").fadeIn();$("#ss-prev").on("click",quickPrev);event.preventDefault()};$("#ss-prev").on("click",quickPrev);$(document.body).on("click",".ss-paginate a",function(e){var t=$(this).index()+1,n=$(".ss-current").index()+1;if(t
n){var r=t-n;for(var i=0;i=n){$(".ss-current").removeClass("ss-current");$(".ss-paginate a:first").addClass("ss-current")}else{$(".ss-current").removeClass("ss-current");$(".ss-paginate a").eq(e).addClass("ss-current")}}function paginateBackwards(){var e=$(".ss-current").index()+1,t=e-2,n=$(".ss-paginate a").length;if(e<=1){$(".ss-current").removeClass("ss-current");$(".ss-paginate a:last").addClass("ss-current")}else{$(".ss-current").removeClass("ss-current");$(".ss-paginate a").eq(t).addClass("ss-current")}}function crossFade(){captionUpdater();paginateForwards();$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)",opacity:"0"}).show();$(".ss-slide:first").css({opacity:"1"})})}function zoomIn(){captionUpdater();paginateForwards();$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").css({webkitTransform:"scale(1.2) rotate(2deg)",msTransform:"scale(1.2) rotate(2deg)",transform:"scale(1.2) rotate(2deg)"})})}function zoomOut(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.2) rotate(2deg)",msTransform:"scale(1.2) rotate(2deg)",transform:"scale(1.2) rotate(2deg)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"})})}function panRight(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(-10%, 0)",msTransform:"scale(1.3) translate(-10%, 0)",transform:"scale(1.3) translate(-10%, 0)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}function panLeft(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(10%, 0)",msTransform:"scale(1.3) translate(10%, 0)",transform:"scale(1.3) translate(10%, 0)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}function panUp(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(0, 10%)",msTransform:"scale(1.3) translate(0, 10%)",transform:"scale(1.3) translate(0, 10%)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}function panDown(){captionUpdater();paginateForwards();$(".ss-slide:eq(-2)").addClass("notrans").css({webkitTransform:"scale(1.3) translate(0, -10%)",msTransform:"scale(1.3) translate(0, -10%)",transform:"scale(1.3) translate(0, -10%)"});$(".ss-slide:last").addClass("notrans").fadeOut("slow",function(){$(this).prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)"}).show();$(".ss-slide:last").removeClass("notrans").css({webkitTransform:"scale(1.3) translate(0,0)",msTransform:"scale(1.3) translate(0,0)",transform:"scale(1.3) translate(0,0)"})})}var defaults={playTimer:6e3,animEasing:"ease-in-out",autoanimType:"random",nextText:" ►",prevText:"◄ ",captions:"true",navigation:"true",pagination:"true",order:"normal"};var options=$.extend(defaults,options),convertSeconds=options.playTimer/1e3-.5;$(".ss-slide").css({webkitTransition:"all "+convertSeconds+"s "+options.animEasing,mozTransition:"all "+convertSeconds+"s "+options.animEasing,msTransition:"all "+convertSeconds+"s "+options.animEasing,oTransition:"all "+convertSeconds+"s "+options.animEasing,transition:"all "+convertSeconds+"s "+options.animEasing});$(".ss-slide:last").css("position","relative");$(".ss-slides").wrap('');$.fn.randomize=function(e){(e?this.find(e):this).parent().each(function(){$(this).children(e).sort(function(){return Math.random()-.5}).detach().appendTo(this)});return this};if(options.captions=="true"){$(".ss-slides-wrap").append('')}var caption=$(".ss-slide:last").attr("title");$(".ss-caption").html(caption);if(options.pagination=="true"){$(".ss-slides-wrap").append('');$(".ss-slide").each(function(){$(".ss-paginate").append('')});$(".ss-paginate a:last").addClass("ss-current")}if(options.navigation=="true"){$(".ss-slides-wrap").append(''+options.prevText+''+options.nextText+"")}if(options.order=="normal"){$(".ss-slide").each(function(){$(this).prependTo(this.parentNode)});$(".ss-slide:first").appendTo(".ss-slides")}else if(options.order=="random"){$(".ss-slide").randomize()}else if(options.order=="reverse"){$(".ss-slide:first").appendTo(".ss-slides")}if(options.autoanimType=="random"){var fns=[zoomOut,zoomIn,panRight,panLeft];fns[Math.floor(Math.random()*fns.length)]()}else if(options.autoanimType=="false"){}else{eval(options.autoanimType+"()")}var fn=function(){if(options.autoanimType=="random"){var fns=[zoomOut,zoomIn,panRight,panLeft,panUp,panDown];fns[Math.floor(Math.random()*fns.length)]()}else if(options.autoanimType=="false"){}else{eval(options.autoanimType+"()")}};var myInterval=setInterval(fn,options.playTimer);$("#ss-prev, #ss-next, .ss-paginate").hover(function(e){clearInterval(myInterval)},function(e){myInterval=setInterval(fn,options.playTimer)});var quickNext=function(){$("#ss-next").off("click");$(".ss-slide:last").addClass("notrans").fadeOut("250",function(){$(".ss-slide:last").prependTo(".ss-slides").removeClass("notrans").css({webkitTransform:"scale(1) rotate(0deg)",msTransform:"scale(1) rotate(0deg)",transform:"scale(1) rotate(0deg)",opacity:"1"}).show();$("#ss-next").on("click",quickNext)});captionUpdater();paginateForwards();event.preventDefault()};$("#ss-next").on("click",quickNext);var quickPrev=function(){$("#ss-prev").off("click");if($(".ss-slide:first").attr("title")){var e=$(".ss-slide:first").attr("title");$(".ss-caption").html(e).show()}else{$(".ss-caption").empty().hide()}paginateBackwards();$(".ss-slide:first").hide().addClass("notrans").appendTo(".ss-slides").fadeIn();$("#ss-prev").on("click",quickPrev);event.preventDefault()};$("#ss-prev").on("click",quickPrev);$(document.body).on("click",".ss-paginate a",function(e){var t=$(this).index()+1,n=$(".ss-current").index()+1;if(tn){var r=t-n;for(var i=0;i