|
|
@ -1,4 +1,4 @@ |
|
|
|
/*! ResponsiveSlides.js v1.07. (c) 2011 Viljami Salminen. MIT License. http://responsive-slides.viljamis.com */ |
|
|
|
/*! ResponsiveSlides.js v1.10. Authors & copyright (c) 2011-2012 Viljami Salminen & Bastian Gutschke. MIT License. http://responsive-slides.viljamis.com */ |
|
|
|
(function ($, window, i) { |
|
|
|
(function ($, window, i) { |
|
|
|
|
|
|
|
|
|
|
|
$.fn.responsiveSlides = function (options) { |
|
|
|
$.fn.responsiveSlides = function (options) { |
|
|
@ -13,41 +13,39 @@ |
|
|
|
|
|
|
|
|
|
|
|
return this.each(function () { |
|
|
|
return this.each(function () { |
|
|
|
|
|
|
|
|
|
|
|
// increment i, which is used for namespacing
|
|
|
|
// Index, which is used for namespacing
|
|
|
|
i++; |
|
|
|
i++; |
|
|
|
|
|
|
|
|
|
|
|
// save handle for the slideshow
|
|
|
|
|
|
|
|
var $this = $(this); |
|
|
|
var $this = $(this); |
|
|
|
|
|
|
|
|
|
|
|
var $slide = $this.children(), |
|
|
|
var $slide = $this.children(), |
|
|
|
$img = $("img", this), |
|
|
|
$img = $("img", this), |
|
|
|
|
|
|
|
index = 0, |
|
|
|
|
|
|
|
length = $slide.size(), |
|
|
|
namespace = "rslides" + i, |
|
|
|
namespace = "rslides" + i, |
|
|
|
|
|
|
|
|
|
|
|
activeClass = namespace + "_here", |
|
|
|
activeClass = namespace + "_here", |
|
|
|
|
|
|
|
visibleClass = namespace + '_on', |
|
|
|
slideClassPrefix = namespace + "_s", |
|
|
|
slideClassPrefix = namespace + "_s", |
|
|
|
|
|
|
|
|
|
|
|
tabsClass = namespace + "_tabs", |
|
|
|
tabsClass = namespace + "_tabs", |
|
|
|
$pagination = $("<ul class=\"" + tabsClass + "\" />"), |
|
|
|
$pagination = $("<ul class=\"" + tabsClass + "\" />"), |
|
|
|
|
|
|
|
|
|
|
|
visible = {"float": "left", "position": "relative"}, |
|
|
|
visible = {"float": "left", "position": "relative"}, |
|
|
|
hidden = {"float": "none", "position": "absolute"}, |
|
|
|
hidden = {"float": "none", "position": "absolute"}; |
|
|
|
|
|
|
|
|
|
|
|
// start index and number of slides
|
|
|
|
|
|
|
|
index = 0, |
|
|
|
|
|
|
|
length = $slide.size(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// animations
|
|
|
|
// Fading animation
|
|
|
|
var slideTo = function (idx) { |
|
|
|
var slideTo = function (idx) { |
|
|
|
|
|
|
|
|
|
|
|
$slide |
|
|
|
$slide |
|
|
|
.stop() |
|
|
|
.stop() |
|
|
|
.fadeOut(settings.fade, function () { |
|
|
|
.fadeOut(settings.fade, function () { |
|
|
|
$( this ).css( hidden ); |
|
|
|
$(this) |
|
|
|
|
|
|
|
.removeClass(visibleClass) |
|
|
|
|
|
|
|
.css(hidden); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.eq(idx) |
|
|
|
.eq(idx) |
|
|
|
.fadeIn(settings.fade, function () { |
|
|
|
.fadeIn(settings.fade, function () { |
|
|
|
$( this ).css( visible ); |
|
|
|
$(this) |
|
|
|
|
|
|
|
.addClass(visibleClass) |
|
|
|
|
|
|
|
.css(visible); |
|
|
|
index = idx; |
|
|
|
index = idx; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -55,17 +53,17 @@ |
|
|
|
// Only run if there's more than one slide
|
|
|
|
// Only run if there's more than one slide
|
|
|
|
if ($slide.size() > 1) { |
|
|
|
if ($slide.size() > 1) { |
|
|
|
|
|
|
|
|
|
|
|
// add ids to each slide
|
|
|
|
// Add ID's to each slide
|
|
|
|
$slide.each(function (i) { |
|
|
|
$slide.each(function (i) { |
|
|
|
this.id = slideClassPrefix + i; |
|
|
|
this.id = slideClassPrefix + i; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// add css to the slideshow
|
|
|
|
// Add max-width
|
|
|
|
$this.css({ |
|
|
|
$this.css({ |
|
|
|
"max-width": settings.maxwidth |
|
|
|
"max-width": settings.maxwidth |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// hide all slides, then show first one
|
|
|
|
// Hide all slides, then show first one
|
|
|
|
$slide |
|
|
|
$slide |
|
|
|
.hide() |
|
|
|
.hide() |
|
|
|
.eq(0) |
|
|
|
.eq(0) |
|
|
@ -75,18 +73,19 @@ |
|
|
|
// Auto: true
|
|
|
|
// Auto: true
|
|
|
|
if (settings.auto === true) { |
|
|
|
if (settings.auto === true) { |
|
|
|
|
|
|
|
|
|
|
|
// rotate slides automatically
|
|
|
|
// Rotate slides automatically
|
|
|
|
setInterval(function () { |
|
|
|
setInterval(function () { |
|
|
|
var idx = index + 1 < length ? index + 1 : 0; |
|
|
|
var idx = index + 1 < length ? index + 1 : 0; |
|
|
|
slideTo(idx); |
|
|
|
slideTo(idx); |
|
|
|
}, settings.speed); |
|
|
|
}, settings.speed); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Auto: false
|
|
|
|
// Auto: false
|
|
|
|
else { |
|
|
|
else { |
|
|
|
|
|
|
|
|
|
|
|
// build pagination
|
|
|
|
// Build pagination
|
|
|
|
var tabMarkup = []; |
|
|
|
var tabMarkup = [] |
|
|
|
$slide.each(function (i) { |
|
|
|
$slide.each(function (i) { |
|
|
|
var n = i + 1; |
|
|
|
var n = i + 1; |
|
|
|
|
|
|
|
|
|
|
@ -99,42 +98,45 @@ |
|
|
|
|
|
|
|
|
|
|
|
var $tabs = $pagination.find("a"); |
|
|
|
var $tabs = $pagination.find("a"); |
|
|
|
|
|
|
|
|
|
|
|
// add click/touch event handler and set first tab active
|
|
|
|
// Click/touch event handler
|
|
|
|
$tabs.on("ontouchstart" in window ? "touchstart" : "click", function (e) { |
|
|
|
$tabs.on("ontouchstart" in window ? "touchstart" : "click", function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
|
|
|
// get index of clicked tab
|
|
|
|
// Prevent click/touch if animated
|
|
|
|
|
|
|
|
if ($('.' + visibleClass + ':animated').length) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get index of clicked tab
|
|
|
|
var idx = $tabs.index(this); |
|
|
|
var idx = $tabs.index(this); |
|
|
|
|
|
|
|
|
|
|
|
// break here if element is already active
|
|
|
|
// Break if element is already active
|
|
|
|
if (index === idx) { |
|
|
|
if (index === idx) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// remove active state from old tab and set new one
|
|
|
|
// Remove active state from old tab and set new one
|
|
|
|
$tabs |
|
|
|
$tabs |
|
|
|
.closest("li") |
|
|
|
.closest("li") |
|
|
|
.removeClass(activeClass) |
|
|
|
.removeClass(activeClass) |
|
|
|
.eq(idx) |
|
|
|
.eq(idx) |
|
|
|
.addClass(activeClass); |
|
|
|
.addClass(activeClass); |
|
|
|
|
|
|
|
|
|
|
|
// do the animation
|
|
|
|
// Do the animation
|
|
|
|
slideTo(idx); |
|
|
|
slideTo(idx); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.eq(0) |
|
|
|
.eq(0) |
|
|
|
.closest("li") |
|
|
|
.closest("li") |
|
|
|
.addClass(activeClass); |
|
|
|
.addClass(activeClass); |
|
|
|
|
|
|
|
|
|
|
|
// inject pagination
|
|
|
|
// Inject pagination
|
|
|
|
$this.after($pagination); |
|
|
|
$this.after($pagination); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add fallback if CSS max-width isn't supported and maxwidth is set
|
|
|
|
// only add fallback if maxwidth isn't supported and maxwidth is set
|
|
|
|
|
|
|
|
if (typeof document.body.style.maxWidth === "undefined" && options && options.maxwidth) { |
|
|
|
if (typeof document.body.style.maxWidth === "undefined" && options && options.maxwidth) { |
|
|
|
|
|
|
|
|
|
|
|
// Fallback to make IE6 support CSS max-width
|
|
|
|
|
|
|
|
var widthSupport = function () { |
|
|
|
var widthSupport = function () { |
|
|
|
|
|
|
|
|
|
|
|
$this.css("width", "100%"); |
|
|
|
$this.css("width", "100%"); |
|
|
@ -143,8 +145,11 @@ |
|
|
|
$this.css("width", settings.maxwidth); |
|
|
|
$this.css("width", settings.maxwidth); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init fallback
|
|
|
|
widthSupport(); |
|
|
|
widthSupport(); |
|
|
|
// bind on window resize
|
|
|
|
|
|
|
|
|
|
|
|
// + Bind on window resize
|
|
|
|
$(window).on("resize", function () { |
|
|
|
$(window).on("resize", function () { |
|
|
|
widthSupport(); |
|
|
|
widthSupport(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -152,6 +157,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
})(jQuery, this, 0); |
|
|
|
})(jQuery, this, 0); |