vendor/assets/javascripts/uikit/components/slideshow.js in uikit2-rails-0.1.3 vs vendor/assets/javascripts/uikit/components/slideshow.js in uikit2-rails-0.1.4

- old
+ new

@@ -1,6 +1,6 @@ -/*! UIkit 2.24.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ +/*! UIkit 2.24.2 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ (function(addon) { var component; if (window.UIkit) { @@ -103,11 +103,18 @@ switch(media[0].nodeName) { case 'IMG': var cover = UI.$('<div class="uk-cover-background uk-position-cover"></div>').css({'background-image':'url('+ media.attr('src') + ')'}); - media.css({'width': '100%','height': 'auto'}); + if (media.attr('width') && media.attr('height')) { + placeholder = UI.$('<canvas></canvas>').attr({width:media.attr('width'), height:media.attr('height')}); + media.replaceWith(placeholder); + media = placeholder; + placeholder = undefined; + } + + media.css({width: '100%',height: 'auto', opacity:0}); slide.prepend(cover).data('cover', cover); break; case 'IFRAME': @@ -345,14 +352,14 @@ hasKenBurns: function(slide) { return (this.options.kenburns && slide.data('cover')); }, next: function() { - this.show(this.slides[this.current + 1] ? (this.current + 1) : 0); + this.show(this.slides[this.current + 1] ? (this.current + 1) : 0, 1); }, previous: function() { - this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1)); + this.show(this.slides[this.current - 1] ? (this.current - 1) : (this.slides.length - 1), -1); }, start: function() { this.stop();