Skip to content
Browse files

added wmode value option

  • Loading branch information...
1 parent c85c0f8 commit 3dd3c668711f4ac5274a79e108a0c2a4ef847dd7 @Mottie Mottie committed Oct 3, 2010
Showing with 30 additions and 16 deletions.
  1. +5 −0 README.textile
  2. +8 −1 index.html
  3. +5 −3 js/jquery.anythingslider.js
  4. +12 −12 js/jquery.anythingslider.min.js
View
5 README.textile
@@ -60,6 +60,8 @@ h2. Default Options
animationTime : 600, // How long the slideshow transition takes (in milliseconds)
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin
+ // Misc options
+ addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
});</pre>
@@ -95,6 +97,9 @@ h3. Formatting Navigation Text
h2. Changelog
+h3. Version 1.42
+* Added <code>addWmodeToObject</code>. When a slider has an embedded object (like a youtube video), the script adds a wmode parameter with the value from this option ("opaque" by default).
+
h3. Version 1.41
* Added <code>theme</code> option and several themes. Themes can now be added to individual AnythingSliders (although they are based largely on CSS).
* Added <code>tooltipClass</code> option which adds the assigned class name to the navigation and play/stop button only if the text is hidden (negative text-indent). The tooltip plugin must be added separately.
View
9 index.html
@@ -196,7 +196,9 @@
delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
animationTime : 600, // How long the slideshow transition takes (in milliseconds)
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin
-
+
+ // Misc options
+ addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
});</pre>
</blockquote>
@@ -250,6 +252,11 @@
<h2>Changelog</h2>
+ <h3>Version 1.42</h3>
+ <ul>
+ <li>Added <code>addWmodeToObject</code>. When a slider has an embedded object (like a youtube video), the script adds a wmode parameter with the value from this option ("opaque" by default).</li>
+ </ul>
+
<h3>Version 1.41</h3>
<ul>
<li>Added <code>theme</code> option and several themes. Themes can now be added to individual AnythingSliders (although they are based largely on CSS).</li>
View
8 js/jquery.anythingslider.js
@@ -1,5 +1,5 @@
/*
- AnythingSlider v1.41
+ AnythingSlider v1.42
By Chris Coyier: http://css-tricks.com
with major improvements by Doug Neiner: http://pixelgraphics.us/
@@ -78,10 +78,10 @@
base.$objects.each(function(){
if ($(this).find('[src*=youtube]').length){
$(this)
- .prepend('<param name="wmode" value="transparent"/>')
+ .prepend('<param name="wmode" value="' + base.options.addWmodeToObject +'"/>')
.parent().wrap('<div id="yt-temp"></div>')
.find('embed[src*=youtube]').attr('src', function(i,s){ return s + '&enablejsapi=1&version=3'; })
- .attr('wmode','transparent').end()
+ .attr('wmode',base.options.addWmodeToObject).end()
.find('param[value*=youtube]').attr('value', function(i,v){ return v + '&enablejsapi=1&version=3'; }).end()
// detach/appendTo required for Chrome
.detach()
@@ -531,6 +531,8 @@
animationTime : 600, // How long the slideshow transition takes (in milliseconds)
easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin
+ // Misc options
+ addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
maxOverallWidth : 32766 // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
};
View
24 js/jquery.anythingslider.min.js
@@ -1,25 +1,25 @@
/*
- AnythingSlider v1.41 minified using Google Closure Compiler
+ AnythingSlider v1.42 minified using Google Closure Compiler
By Chris Coyier: http://css-tricks.com
with major improvements by Doug Neiner: http://pixelgraphics.us/
based on work by Remy Sharp: http://jqueryfordesigners.com/
*/
(function($){$.anythingSlider=function(f,g){var a=this;a.$el=$(f).addClass("anythingBase").wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');a.$el.data("AnythingSlider",a);a.init=function(){a.options=$.extend({},$.anythingSlider.defaults,g);a.$wrapper=a.$el.parent().closest("div.anythingSlider").addClass("anythingSlider-"+a.options.theme);a.$window=a.$el.closest("div.anythingWindow");a.$controls=$('<div class="anythingControls"></div>').appendTo(a.$wrapper);a.$items=a.$el.find("> li").addClass("panel");
a.$objects=a.$items.find("object");a.currentPage=a.options.startPanel;a.pages=a.$items.length;a.timer=null;a.playing=false;a.hovered=false;a.hasObj=!!a.$objects.length;a.theme={};a.panelSize=[];a.runTimes=$("div.anythingSlider").index(a.$wrapper)+1;if(!$.isFunction($.easing[a.options.easing]))a.options.easing="swing";if(a.options.theme!="default")$("link[href*="+a.options.theme+"]").length||$("body").append('<link rel="stylesheet" href="'+a.options.themeDirectory.replace(/\{themeName\}/g,a.options.theme)+
-'" type="text/css" />');if(a.options.resizeContents){a.options.width&&a.$wrapper.add(a.$items).css("width",a.options.width);a.options.height&&a.$wrapper.add(a.$items).css("height",a.options.height);a.hasObj&&a.$objects.find("embed").andSelf().css({width:"100%",height:"100%"})}a.$objects.each(function(){$(this).find("[src*=youtube]").length&&$(this).prepend('<param name="wmode" value="transparent"/>').parent().wrap('<div id="yt-temp"></div>').find("embed[src*=youtube]").attr("src",function(b,c){return c+
-"&enablejsapi=1&version=3"}).attr("wmode","transparent").end().find("param[value*=youtube]").attr("value",function(b,c){return c+"&enablejsapi=1&version=3"}).end().detach().appendTo($("#yt-temp")).unwrap()});if(a.pages===1){a.options.autoPlay=false;a.options.buildNavigation=false;a.options.buildArrows=false}if(a.options.autoPlay){a.playing=!a.options.startStopped;a.buildAutoPlay()}a.buildNavigation();a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned").removeAttr("id"));a.$el.append(a.$items.filter(":first").clone().addClass("cloned").removeAttr("id"));
-a.$items=a.$el.find("> li");a.setDimensions();a.options.resizeContents||$(window).load(function(){a.setDimensions()});a.options.buildArrows&&a.buildNextBackButtons();a.options.pauseOnHover&&a.$wrapper.hover(function(){a.clearTimer()},function(){a.startStop(a.playing)});if(a.options.hashTags===true&&!a.gotoHash()||a.options.hashTags===false)a.setCurrentPage(a.options.startPanel,false);a.$items.find("a").focus(function(){a.$items.find(".focusedLink").removeClass("focusedLink");$(this).addClass("focusedLink");
-a.$items.each(function(b){if($(this).find("a.focusedLink").length){a.gotoPage(b);return false}})});a.slideControls(false);a.$wrapper.hover(function(b){a.hovered=b.type=="mouseenter"?true:false;a.slideControls(a.hovered,false)});$(window).keyup(function(b){if(a.$wrapper.is(".activeSlider"))switch(b.which){case 39:a.goForward();break;case 37:a.goBack()}})};a.buildNavigation=function(){a.$nav=$('<ul class="thumbNav" />').appendTo(a.$controls);a.options.playRtl&&a.$wrapper.addClass("rtl");a.options.buildNavigation&&
-a.pages>1&&a.$items.each(function(b){var c=b+1;b=$("<a href='#'></a>").addClass("panel"+c).wrap("<li />");a.$nav.append(b);if(typeof a.options.navigationFormatter=="function"){var d=a.options.navigationFormatter(c,$(this));b.html(d);parseInt(b.css("text-indent"),10)<0&&b.addClass(a.options.tooltipClass).attr("title",d)}else b.text(c);b.bind("click focusin",function(e){a.gotoPage(c);a.options.hashTags&&a.setHash("panel"+a.runTimes+"-"+c);e.preventDefault()})})};a.buildNextBackButtons=function(){a.$forward=
-$('<span class="arrow forward"><a href="#">'+a.options.forwardText+"</a></span>");a.$back=$('<span class="arrow back"><a href="#">'+a.options.backText+"</a></span>");a.$back.click(function(b){a.goBack();b.preventDefault()});a.$forward.click(function(b){a.goForward();b.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){$(this).toggleClass("hover")});a.$wrapper.prepend(a.$forward).prepend(a.$back);a.$arrowWidth=a.$forward.width()};a.buildAutoPlay=function(){a.$startStop=
-$("<a href='#' class='start-stop'></a>").html(a.playing?a.options.stopText:a.options.startText);a.$controls.append(a.$startStop);a.$startStop.click(function(b){a.startStop(!a.playing);if(a.playing)a.options.playRtl?a.goBack(true):a.goForward(true);b.preventDefault()}).bind("focusin focusout",function(){$(this).toggleClass("hover")});a.startStop(a.playing)};a.setDimensions=function(){var b,c,d,e,h,i=0,j=a.$window.width(),k=$(window).width();a.$items.each(function(l){d=$(this).children("*");if(a.options.resizeContents){b=
-parseInt(a.options.width,10)||j;c=parseInt(a.options.height,10)||a.$window.height();$(this).css({width:b,height:c});d.length==1&&d.css({width:b,height:c})}else{b=$(this).width();h=b>=k?true:false;if(d.length==1&&h){e=d.width()>=k?j:d.width();$(this).css("width",e);d.css("max-width",e);b=e}b=h?a.options.width||j:b;$(this).css("width",b);c=$(this).outerHeight();$(this).css("height",c)}a.panelSize[l]=[b,c,i];i+=b});a.$el.css("width",i<a.options.maxOverallWidth?i:a.options.maxOverallWidth)};a.gotoPage=
-function(b,c){if(typeof b==="undefined"||b===null){b=a.options.startPage;a.setCurrentPage(a.options.startPage)}if(!a.checkVideo(a.playing)){a.slideControls(true,false);if(b>a.pages+1)b=a.pages;if(b<0)b=1;if(c!==true)c=false;if(!c||a.options.stopAtEnd&&b==a.pages)a.startStop(false);a.options.resizeContents||a.$wrapper.filter(":not(:animated)").animate({width:a.panelSize[b][0],height:a.panelSize[b][1]},{queue:false,duration:a.options.animationTime,easing:a.options.easing});a.$window.filter(":not(:animated)").animate({scrollLeft:a.panelSize[b][2]},
+'" type="text/css" />');if(a.options.resizeContents){a.options.width&&a.$wrapper.add(a.$items).css("width",a.options.width);a.options.height&&a.$wrapper.add(a.$items).css("height",a.options.height);a.hasObj&&a.$objects.find("embed").andSelf().css({width:"100%",height:"100%"})}a.$objects.each(function(){$(this).find("[src*=youtube]").length&&$(this).prepend('<param name="wmode" value="'+a.options.addWmodeToObject+'"/>').parent().wrap('<div id="yt-temp"></div>').find("embed[src*=youtube]").attr("src",
+function(b,c){return c+"&enablejsapi=1&version=3"}).attr("wmode",a.options.addWmodeToObject).end().find("param[value*=youtube]").attr("value",function(b,c){return c+"&enablejsapi=1&version=3"}).end().detach().appendTo($("#yt-temp")).unwrap()});if(a.pages===1){a.options.autoPlay=false;a.options.buildNavigation=false;a.options.buildArrows=false}if(a.options.autoPlay){a.playing=!a.options.startStopped;a.buildAutoPlay()}a.buildNavigation();a.$el.prepend(a.$items.filter(":last").clone().addClass("cloned").removeAttr("id"));
+a.$el.append(a.$items.filter(":first").clone().addClass("cloned").removeAttr("id"));a.$items=a.$el.find("> li");a.setDimensions();a.options.resizeContents||$(window).load(function(){a.setDimensions()});a.options.buildArrows&&a.buildNextBackButtons();a.options.pauseOnHover&&a.$wrapper.hover(function(){a.clearTimer()},function(){a.startStop(a.playing)});if(a.options.hashTags===true&&!a.gotoHash()||a.options.hashTags===false)a.setCurrentPage(a.options.startPanel,false);a.$items.find("a").focus(function(){a.$items.find(".focusedLink").removeClass("focusedLink");
+$(this).addClass("focusedLink");a.$items.each(function(b){if($(this).find("a.focusedLink").length){a.gotoPage(b);return false}})});a.slideControls(false);a.$wrapper.hover(function(b){a.hovered=b.type=="mouseenter"?true:false;a.slideControls(a.hovered,false)});$(window).keyup(function(b){if(a.$wrapper.is(".activeSlider"))switch(b.which){case 39:a.goForward();break;case 37:a.goBack()}})};a.buildNavigation=function(){a.$nav=$('<ul class="thumbNav" />').appendTo(a.$controls);a.options.playRtl&&a.$wrapper.addClass("rtl");
+a.options.buildNavigation&&a.pages>1&&a.$items.each(function(b){var c=b+1;b=$("<a href='#'></a>").addClass("panel"+c).wrap("<li />");a.$nav.append(b);if(typeof a.options.navigationFormatter=="function"){var d=a.options.navigationFormatter(c,$(this));b.html(d);parseInt(b.css("text-indent"),10)<0&&b.addClass(a.options.tooltipClass).attr("title",d)}else b.text(c);b.bind("click focusin",function(e){a.gotoPage(c);a.options.hashTags&&a.setHash("panel"+a.runTimes+"-"+c);e.preventDefault()})})};a.buildNextBackButtons=
+function(){a.$forward=$('<span class="arrow forward"><a href="#">'+a.options.forwardText+"</a></span>");a.$back=$('<span class="arrow back"><a href="#">'+a.options.backText+"</a></span>");a.$back.click(function(b){a.goBack();b.preventDefault()});a.$forward.click(function(b){a.goForward();b.preventDefault()});a.$back.add(a.$forward).find("a").bind("focusin focusout",function(){$(this).toggleClass("hover")});a.$wrapper.prepend(a.$forward).prepend(a.$back);a.$arrowWidth=a.$forward.width()};a.buildAutoPlay=
+function(){a.$startStop=$("<a href='#' class='start-stop'></a>").html(a.playing?a.options.stopText:a.options.startText);a.$controls.append(a.$startStop);a.$startStop.click(function(b){a.startStop(!a.playing);if(a.playing)a.options.playRtl?a.goBack(true):a.goForward(true);b.preventDefault()}).bind("focusin focusout",function(){$(this).toggleClass("hover")});a.startStop(a.playing)};a.setDimensions=function(){var b,c,d,e,h,i=0,j=a.$window.width(),k=$(window).width();a.$items.each(function(l){d=$(this).children("*");
+if(a.options.resizeContents){b=parseInt(a.options.width,10)||j;c=parseInt(a.options.height,10)||a.$window.height();$(this).css({width:b,height:c});d.length==1&&d.css({width:b,height:c})}else{b=$(this).width();h=b>=k?true:false;if(d.length==1&&h){e=d.width()>=k?j:d.width();$(this).css("width",e);d.css("max-width",e);b=e}b=h?a.options.width||j:b;$(this).css("width",b);c=$(this).outerHeight();$(this).css("height",c)}a.panelSize[l]=[b,c,i];i+=b});a.$el.css("width",i<a.options.maxOverallWidth?i:a.options.maxOverallWidth)};
+a.gotoPage=function(b,c){if(typeof b==="undefined"||b===null){b=a.options.startPage;a.setCurrentPage(a.options.startPage)}if(!a.checkVideo(a.playing)){a.slideControls(true,false);if(b>a.pages+1)b=a.pages;if(b<0)b=1;if(c!==true)c=false;if(!c||a.options.stopAtEnd&&b==a.pages)a.startStop(false);a.options.resizeContents||a.$wrapper.filter(":not(:animated)").animate({width:a.panelSize[b][0],height:a.panelSize[b][1]},{queue:false,duration:a.options.animationTime,easing:a.options.easing});a.$window.filter(":not(:animated)").animate({scrollLeft:a.panelSize[b][2]},
{queue:false,duration:a.options.animationTime,easing:a.options.easing,complete:function(){a.endAnimation(b)}})}};a.endAnimation=function(b){if(b===0){a.$window.scrollLeft(a.panelSize[a.pages][2]);b=a.pages}else if(b>a.pages){a.$window.scrollLeft(0);b=1}a.setCurrentPage(b,false);a.hovered||a.slideControls(false);if(a.hasObj){b=a.$items.eq(a.currentPage).find("embed[src*=youtube]");try{b.length&&$.isFunction(b[0].getPlayerState)&&b[0].getPlayerState()>0&&b[0].playVideo()}catch(c){}}};a.setCurrentPage=
function(b,c){if(a.options.buildNavigation){a.$nav.find(".cur").removeClass("cur");a.$nav.find("a").eq(b-1).addClass("cur")}if(!c){a.$wrapper.css({width:a.panelSize[b][0],height:a.panelSize[b][1]});a.$wrapper.scrollLeft(0);a.$window.scrollLeft(a.panelSize[b][2])}a.currentPage=b;if(!a.$wrapper.is(".activeSlider")){$(".activeSlider").removeClass("activeSlider");a.$wrapper.addClass("activeSlider")}};a.goForward=function(b){if(b!==true){b=false;a.startStop(false)}a.gotoPage(a.currentPage+1,b)};a.goBack=
function(b){if(b!==true){b=false;a.startStop(false)}a.gotoPage(a.currentPage-1,b)};a.gotoHash=function(){var b=window.location.hash.match(/^#?panel(\d+)-(\d+)$/);if(b)if(parseInt(b[1],10)==a.runTimes){b=parseInt(b[2],10);if(a.$items.filter(":eq("+b+")").length!==0){a.setCurrentPage(b,false);return true}}return false};a.setHash=function(b){if(typeof window.location.hash!=="undefined"){if(window.location.hash!==b)window.location.hash=b}else if(location.hash!==b)location.hash=b;return b};a.slideControls=
function(b){var c=b?"slideDown":"slideUp",d=b?0:a.options.animationTime,e=b?a.options.animationTime:0;b=b?0:1;a.options.toggleControls&&a.$controls.stop(true,true).delay(d)[c](a.options.animationTime/2).delay(e);if(a.options.toggleArrows){if(!a.hovered&&a.playing)b=1;a.$forward.stop(true,true).delay(d).animate({right:b*a.$arrowWidth,opacity:e},a.options.animationTime/2);a.$back.stop(true,true).delay(d).animate({left:b*a.$arrowWidth,opacity:e},a.options.animationTime/2)}};a.clearTimer=function(){a.timer&&
window.clearInterval(a.timer)};a.startStop=function(b){if(b!==true)b=false;a.playing=b;if(a.options.autoPlay){a.$startStop.toggleClass("playing",b).html(b?a.options.stopText:a.options.startText);if(parseInt(a.$startStop.css("text-indent"),10)<0)a.$startStop.addClass(a.options.tooltipClass).attr("title",b?"Stop":"Start")}if(b){a.clearTimer();a.timer=window.setInterval(function(){a.checkVideo(b)||(a.options.playRtl?a.goBack(true):a.goForward(true))},a.options.delay)}else a.clearTimer()};a.checkVideo=
function(b){var c,d,e=false;a.hasObj&&a.$objects.each(function(){c=$(this).find("embed[src*=youtube]");try{if(c.length&&$.isFunction(c[0].getPlayerState)){d=c[0].getPlayerState();if(b&&d==1&&a.$items.index(c.closest("li"))==a.currentPage&&a.options.resumeOnVideoEnd)e=true;else d>0&&c[0].pauseVideo()}}catch(h){}});return e};a.init()};$.anythingSlider.defaults={width:null,height:null,resizeContents:true,tooltipClass:"tooltip",theme:"default",themeDirectory:"css/theme-{themeName}.css",startPanel:1,hashTags:true,
-buildArrows:true,toggleArrows:false,buildNavigation:true,toggleControls:false,navigationFormatter:null,forwardText:"&raquo;",backText:"&laquo;",autoPlay:true,startStopped:false,pauseOnHover:true,resumeOnVideoEnd:true,stopAtEnd:false,playRtl:false,startText:"Start",stopText:"Stop",delay:3E3,animationTime:600,easing:"swing",maxOverallWidth:32766};$.fn.anythingSlider=function(f){if((typeof f).match("object|undefined"))return this.each(function(){$(this).is(".anythingBase")||new $.anythingSlider(this,
-f)});else if(/\d/.test(f)&&!isNaN(f))return this.each(function(){var g=$(this).data("AnythingSlider");if(g){var a=typeof f=="number"?f:parseInt($.trim(f),10);a<1||a>g.pages||g.gotoPage(a)}})}})(jQuery);
+buildArrows:true,toggleArrows:false,buildNavigation:true,toggleControls:false,navigationFormatter:null,forwardText:"&raquo;",backText:"&laquo;",autoPlay:true,startStopped:false,pauseOnHover:true,resumeOnVideoEnd:true,stopAtEnd:false,playRtl:false,startText:"Start",stopText:"Stop",delay:3E3,animationTime:600,easing:"swing",addWmodeToObject:"opaque",maxOverallWidth:32766};$.fn.anythingSlider=function(f){if((typeof f).match("object|undefined"))return this.each(function(){$(this).is(".anythingBase")||
+new $.anythingSlider(this,f)});else if(/\d/.test(f)&&!isNaN(f))return this.each(function(){var g=$(this).data("AnythingSlider");if(g){var a=typeof f=="number"?f:parseInt($.trim(f),10);a<1||a>g.pages||g.gotoPage(a)}})}})(jQuery);

0 comments on commit 3dd3c66

Please sign in to comment.
Something went wrong with that request. Please try again.