diff --git a/jquery.backgroundvideo.js b/jquery.backgroundvideo.js index 0921f17..d86f8fe 100644 --- a/jquery.backgroundvideo.js +++ b/jquery.backgroundvideo.js @@ -35,7 +35,8 @@ html += 'style="display:none;position:fixed;top:0;left:0;bottom:0;right:0;z-index:-100;width:100%;height:100%;">'; for(var i=0; i < plugin.settings.types.length; i++) { - html += ''; + var vpath = plugin.settings.path[plugin.settings.types[i]] || plugin.settings.path; + html += ''; } html += 'bgvideo'; plugin.el.prepend(html); diff --git a/jquery.backgroundvideo.min.js b/jquery.backgroundvideo.min.js index 7728552..a09eccc 100644 --- a/jquery.backgroundvideo.min.js +++ b/jquery.backgroundvideo.min.js @@ -5,4 +5,4 @@ * Released under the MIT, BSD, and GPL Licenses. * based on jQuery Plugin Boilerplate 1.3 */ -(function(e){e.backgroundVideo=function(t,n){var r={videoid:"video_background"};var i=this;i.settings={};var s=function(){i.settings=e.extend({},r,n);i.el=t;o()};var o=function(){var t="";t+='";i.el.prepend(t);i.videoEl=document.getElementById(i.settings.videoid);i.$videoEl=e(i.videoEl);i.$videoEl.fadeIn(2e3);u()};var u=function(){var e=a();i.$videoEl.width(e*i.settings.width);i.$videoEl.height(e*i.settings.height);if(typeof i.settings.align!=="undefined"){f()}};var a=function(){var t=e(window).width();var n=e(window).height();var r=t/n;var s=i.settings.width/i.settings.height;var o=n/i.settings.height;if(r>=s){o=t/i.settings.width}return o};var f=function(){var t=(e(window).width()>>1)-(i.$videoEl.width()>>1)|0;var n=(e(window).height()>>1)-(i.$videoEl.height()>>1)|0;if(i.settings.align=="centerXY"){i.$videoEl.css({left:t,top:n});return}if(i.settings.align=="centerX"){i.$videoEl.css("left",t);return}if(i.settings.align=="centerY"){i.$videoEl.css("top",n);return}};s();e(window).resize(function(){u()});i.$videoEl.bind("ended",function(){this.play()})}})(jQuery) +(function(e){e.backgroundVideo=function(t,n){var r={videoid:"video_background"};var i=this;i.settings={};var s=function(){i.settings=e.extend({},r,n);i.el=t;o()};var o=function(){var t="";t+='";i.el.prepend(t);i.videoEl=document.getElementById(i.settings.videoid);i.$videoEl=e(i.videoEl);i.$videoEl.fadeIn(2e3);u()};var u=function(){var e=a();i.$videoEl.width(e*i.settings.width);i.$videoEl.height(e*i.settings.height);if(typeof i.settings.align!=="undefined"){f()}};var a=function(){var t=e(window).width();var n=e(window).height();var r=t/n;var s=i.settings.width/i.settings.height;var o=n/i.settings.height;if(r>=s){o=t/i.settings.width}return o};var f=function(){var t=(e(window).width()>>1)-(i.$videoEl.width()>>1)|0;var n=(e(window).height()>>1)-(i.$videoEl.height()>>1)|0;if(i.settings.align=="centerXY"){i.$videoEl.css({left:t,top:n});return}if(i.settings.align=="centerX"){i.$videoEl.css("left",t);return}if(i.settings.align=="centerY"){i.$videoEl.css("top",n);return}};s();e(window).resize(function(){u()});i.$videoEl.bind("ended",function(){this.play()})}})(jQuery) diff --git a/readme.md b/readme.md index c4e2d47..4cb793a 100644 --- a/readme.md +++ b/readme.md @@ -25,6 +25,7 @@ And launch the plugin : }); +The path option can be a string or an object with properties corresponding to the types array members, in case you need to reference videos in different locations. ## Examples