From aa19c50f3941853ba167198bf14ae4e126ac05f3 Mon Sep 17 00:00:00 2001 From: Viljami S Date: Mon, 5 Mar 2012 17:30:31 +0200 Subject: [PATCH] Changed settings/options handling. (by @bgutschke) --- README.md | 2 +- responsiveslides.js | 7 ++----- responsiveslides.min.js | 8 ++++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2a4f8c0..301cf7c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [ResponsiveSlides.js](http://responsive-slides.viljamis.com/) is a tiny jQuery plugin that creates a responsive slideshow using images inside a single container. It works with wide range of browsers including all IE versions from IE6 and up. It also adds css max-width support for IE6 and other browsers that don't natively support it. Only dependency is [jQuery](http://jquery.com/) and that all the images are same size. -Biggest difference to other responsive slideshow plugins is the file size (799 bytes minified and gzipped) + that this one doesn't try to do everything. ResponsiveSlides.js has basically only two different modes: Either it just automatically fades the images, or operates as a responsive image container with pagination to navigate/fade between slides. +Biggest difference to other responsive slideshow plugins is the file size (797 bytes minified and gzipped) + that this one doesn't try to do everything. ResponsiveSlides.js has basically only two different modes: Either it just automatically fades the images, or operates as a responsive image container with pagination to navigate/fade between slides. Usage Instructions and demo diff --git a/responsiveslides.js b/responsiveslides.js index 2a30c54..89a5748 100644 --- a/responsiveslides.js +++ b/responsiveslides.js @@ -2,19 +2,16 @@ (function ($, window, i) { $.fn.responsiveSlides = function (options) { // Settings - var settings = { + var settings = $.extend({ 'speed' : 4000, 'fade' : 1000, 'auto' : true, 'maxwidth' : 'none' - }; + }, options); return this.each(function () { i++; var $this = $(this); - if (options) { - $.extend(settings, options); - } var slideshow = function () { var $slide = $this.find('img'), diff --git a/responsiveslides.min.js b/responsiveslides.min.js index 56e0175..d13253b 100644 --- a/responsiveslides.min.js +++ b/responsiveslides.min.js @@ -1,5 +1,5 @@ /*! ResponsiveSlides.js v1.05. (c) 2011-2012 Viljami Salminen. MIT License. http://responsive-slides.viljamis.com */ -(function(a,o,n){a.fn.responsiveSlides=function(d){var e={speed:4E3,fade:1E3,auto:!0,maxwidth:"none"};return this.each(function(){n++;var b=a(this);d&&a.extend(e,d);var g=function(){var a=parseFloat(e.maxwidth);d&&d.maxwidth&&"undefined"===typeof document.body.style.maxHeight&&b.each(function(){b.css("width","100%");b.width()>a?b.css("width",a):b.width()'), -j=parseFloat(e.fade),l={position:"relative","float":"left"},g={position:"absolute","float":"none"};if(1'+a+""});c.append(m);b.after(c).find(":first-child").addClass(h);a("."+i+"1").parent().addClass(d);a("."+k+" a").each(function(b){var c=a(this);c.click(function(e){e.preventDefault();if(a("."+h+":animated").length)return!1;c.parent().hasClass(d)||(a("."+k+" li").removeClass(d),a("."+h).stop().fadeOut(j,function(){a(this).removeClass(h).css(g)}).end(),a("#"+i+b).stop().fadeIn(j,function(){a(this).addClass(h).css(l)}).end(), -c.parent().addClass(d))})})}})();g();a(o).resize(function(){g()})})}})(jQuery,this,0); \ No newline at end of file +(function(a,o,n){a.fn.responsiveSlides=function(e){var f=a.extend({speed:4E3,fade:1E3,auto:!0,maxwidth:"none"},e);return this.each(function(){n++;var b=a(this),g=function(){var a=parseFloat(f.maxwidth);e&&e.maxwidth&&"undefined"===typeof document.body.style.maxHeight&&b.each(function(){b.css("width","100%");b.width()>a?b.css("width",a):b.width()'),k=parseFloat(f.fade), +l={position:"relative","float":"left"},g={position:"absolute","float":"none"};if(1'+a+""});c.append(m);b.after(c).find(":first-child").addClass(h);a("."+i+"1").parent().addClass(j);a("."+e+" a").each(function(b){var c=a(this);c.click(function(d){d.preventDefault();if(a("."+h+":animated").length)return!1;c.parent().hasClass(j)||(a("."+e+" li").removeClass(j),a("."+h).stop().fadeOut(k,function(){a(this).removeClass(h).css(g)}).end(),a("#"+i+b).stop().fadeIn(k,function(){a(this).addClass(h).css(l)}).end(), +c.parent().addClass(j))})})}})();g();a(o).resize(function(){g()})})}})(jQuery,this,0); \ No newline at end of file