Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added $.colorbox.remove()

  • Loading branch information...
commit 82bc365590a74e2a11ccec6870001668aac06523 1 parent 6f9a56f
Jack Moore authored
View
6 README
@@ -11,12 +11,12 @@ http://groups.google.com/group/colorbox/topics
RELEASE NOTES:
----------------------------------------------------------------------------------------------------------
-Version 1.3.7 - June 11 2010
+Version 1.3.7 - June 12 2010
Files Changed: jquery.colorbox.js/jquery.colorbox-min.js
* $.colorbox can now be used for direct calls and accessing public methods. Example: $.colorbox.close();
* Resize now accepts 'width', 'innerWidth', 'height' and 'innerHeight'. Example: $.colorbox.resize({width:"100%"})
-* Added option to disable looping in a group.
-* Added option to disable esc-key and arrow-key bindings.
+* Added option (loop:false) to disable looping in a group.
+* Added options (escKey:false, arrowKey:false) to disable esc-key and arrow-key bindings.
* Fixed a bug where iframed URLs would be truncated if they contained an unencoded apostrophe.
* Now uses the exact href specified on an anchor, rather than the version returned by 'this.href'.
This was causing "#example" to be normalized to "http://domain/#example" which interfered with how some
View
2  colorbox/jquery.colorbox-min.js
@@ -1,2 +1,2 @@
/* ColorBox v1.3.7 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
-(function(c){function p(b,d){d=d==="x"?l.width():l.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function O(b){b=c.isFunction(b)?b.call(g):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function $(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(g);a.rel=a.rel||g.rel||"nofollow";a.href=a.href||c(g).attr("href");a.title=a.title||g.title}function aa(b){g=b;a=c.extend({},c(g).data(u)); $();if(a.rel!=="nofollow"){i=c(".cboxElement").filter(function(){return(c(this).data(u).rel||this.rel)===a.rel});h=i.index(g);if(h<0){i=i.add(g);h=i.length-1}}else{i=c(g);h=0}if(!q){z=q=m;P=g;P.blur();c.event.trigger(ca);a.onOpen&&a.onOpen.call(g);r.css({opacity:a.opacity,cursor:a.overlayClose?"pointer":"auto"}).show();a.w=p(a.initialWidth,"x");a.h=p(a.initialHeight,"y");e.position(0);Q&&l.bind("resize.cboxIE6 scroll.cboxIE6",function(){r.css({width:l.width(),height:l.height(),top:l.scrollTop(),left:l.scrollLeft()})}).trigger("scroll.cboxIE6")}R.add(G).add(H).add(s).add(S).hide(); T.html(a.close).show();e.slideshow();e.load()}var u="colorbox",I="hover",m=true,e,A=c.browser.msie&&!c.support.opacity,Q=A&&c.browser.version<7,ca="cbox_open",K="cbox_load",U="cbox_complete",r,j,v,o,V,W,X,Y,i,l,n,L,M,N,S,R,s,H,G,T,B,C,w,x,g,P,h,a,q,z,ba={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:m,scrolling:m,inline:false,html:false,iframe:false,photo:false,href:false, title:false,rel:false,opacity:0.9,preloading:m,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:m,loop:false,slideshow:false,slideshowAuto:m,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,escKey:m,arrowKey:m};e=c.fn.colorbox=c.colorbox=function(b,d){var f=this;b||(b={});if(d)b.onComplete=d;if(!f.selector||f.selector===""){f=c("<a/>"); b.open=m}f.each(function(){c(this).data(u,c.extend({},c(this).data(u)||ba,b)).addClass("cboxElement")});b.open&&aa(f[0]);return f};e.init=function(){function b(d){return c('<div id="cbox'+d+'"/>')}l=c(window);j=c('<div id="colorbox"/>');r=b("Overlay").hide();v=b("Wrapper");o=b("Content").append(n=b("LoadedContent").css({width:0,height:0}),M=b("LoadingOverlay"),N=b("LoadingGraphic"),S=b("Title"),R=b("Current"),s=b("Slideshow"),H=b("Next"),G=b("Previous"),T=b("Close"));v.append(c("<div/>").append(b("TopLeft"), V=b("TopCenter"),b("TopRight")),c("<div/>").append(W=b("MiddleLeft"),o,X=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),Y=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"});L=c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");c("body").prepend(r,j.append(v,L));if(A){j.addClass("cboxIE");Q&&r.css("position","absolute")}o.children().bind("mouseover mouseout",function(){c(this).toggleClass(I)}).addClass(I);B=V.height()+Y.height()+o.outerHeight(m)- o.height();C=W.width()+X.width()+o.outerWidth(m)-o.width();w=n.outerHeight(m);x=n.outerWidth(m);j.css({"padding-bottom":B,"padding-right":C}).hide();H.click(e.next);G.click(e.prev);T.click(e.close);o.children().removeClass(I);c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined"||d.ctrlKey||d.shiftKey||d.altKey)return m;else{aa(this);return false}});r.click(function(){a.overlayClose&&e.close()});c(document).bind("keydown",function(d){if(q&&a.escKey&&d.keyCode=== 27){d.preventDefault();e.close()}if(q&&a.arrowKey&&!z&&i.length>1)if(d.keyCode===37){d.preventDefault();G.click()}else if(d.keyCode===39){d.preventDefault();H.click()}})};e.position=function(b,d){function f(y){V[0].style.width=Y[0].style.width=o[0].style.width=y.style.width;N[0].style.height=M[0].style.height=o[0].style.height=W[0].style.height=X[0].style.height=y.style.height}var k=Math.max(l.height()-a.h-w-B,0)/2+l.scrollTop(),t=Math.max(l.width()-a.w-x-C,0)/2+l.scrollLeft();b=j.width()===a.w+x&& j.height()===a.h+w?0:b;v[0].style.width=v[0].style.height="9999px";j.dequeue().animate({width:a.w+x,height:a.h+w,top:k,left:t},{duration:b,complete:function(){f(this);z=false;v[0].style.width=a.w+x+C+"px";v[0].style.height=a.h+w+B+"px";d&&d()},step:function(){f(this)}})};e.resize=function(b){function d(){a.w=a.w||n.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function f(){a.h=a.h||n.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function k(J){e.position(J,function(){if(q){if(A){t&&n.fadeIn(100); j[0].style.removeAttribute("filter")}if(a.iframe)n.append("<iframe id='cboxIframe'"+(a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(A?"allowtransparency='true'":"")+" />");n.show();S.show().html(a.title);(function(){var D,E,F=i.length,Z=a.loop;if(F>1){R.html(a.current.replace(/\{current\}/,h+1).replace(/\{total\}/,F)).show();H[Z||h<F-1?"show":"hide"]().html(a.next);G[Z||h>0?"show":"hide"]().html(a.prev);D=h>0?i[h-1]:i[F-1];E=h<F-1?i[h+ 1]:i[0];if(a.slideshow){s.show();h==F-1&&!Z&&j.is(".cboxSlideshow_on")&&s.click()}if(a.preloading){E=c(E).data(u).href||E.href;D=c(D).data(u).href||D.href;if(O(E))c("<img />")[0].src=E;if(O(D))c("<img />")[0].src=D}}})();M.hide();N.hide();a.transition==="fade"&&j.fadeTo(y,1,function(){A&&j[0].style.removeAttribute("filter")});l.bind("resize.cbox",function(){e.position(0)});c.event.trigger(U);a.onComplete&&a.onComplete.call(g)}})}if(q){var t,y=a.transition==="none"?0:a.speed;l.unbind("resize.cbox"); if(b){n.remove();n=c('<div id="cboxLoadedContent"/>').html(b);n.hide().appendTo(L).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:f()}).prependTo(o);c("#cboxPhoto").css({cssFloat:"none"});Q&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition==="fade"&&j.fadeTo(y,0,function(){k(0)})||k(y)}else setTimeout(function(){var J=n.wrapInner("<div style='overflow:auto'></div>").children(); a.h=J.height();n.css({height:a.h});J.replaceWith(J.children());e.position(y)},1)}};e.load=function(){var b,d,f,k=e.resize;z=m;g=i[h];a=c.extend({},c(g).data(u));$();c.event.trigger(K);a.onLoad&&a.onLoad.call(g);a.h=a.height?p(a.height,"y")-w-B:a.innerHeight?p(a.innerHeight,"y"):false;a.w=a.width?p(a.width,"x")-x-C:a.innerWidth?p(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,"x")-x-C;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,"y")-w-B;a.mh=a.h&&a.h< a.mh?a.h:a.mh}b=a.href;M.show();N.show();if(a.inline){c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(K+" cbox_cleanup",function(){c(this).replaceWith(n.children())});k(c(b))}else if(a.iframe)k(" ");else if(a.html)k(a.html);else if(O(b)){d=new Image;d.onload=function(){var t;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){f=function(){d.height-=d.height*t;d.width-=d.width*t};if(a.mw&&d.width>a.mw){t=(d.width- a.mw)/d.width;f()}if(a.mh&&d.height>a.mh){t=(d.height-a.mh)/d.height;f()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";k(d);i.length>1&&c(d).css({cursor:"pointer"}).click(e.next);if(A)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div><p>Request unsuccessful.</p></div>").appendTo(L).load(b,function(){k(this)})};e.next=function(){if(!z){h=h<i.length-1?h+1:0;e.load()}};e.prev=function(){if(!z){h=h>0?h-1:i.length-1;e.load()}};e.slideshow=function(){function b(){s.text(a.slideshowStop).bind(U, function(){f=setTimeout(e.next,a.slideshowSpeed)}).bind(K,function(){clearTimeout(f)}).one("click",function(){d();c(this).removeClass(I)});j.removeClass(k+"off").addClass(k+"on")}var d,f,k="cboxSlideshow_";s.bind("cbox_closed",function(){s.unbind();clearTimeout(f);j.removeClass(k+"off "+k+"on")});d=function(){clearTimeout(f);s.text(a.slideshowStart).unbind(U+" "+K).one("click",function(){b();f=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(I)});j.removeClass(k+"on").addClass(k+"off")};if(a.slideshow&& i.length>1)a.slideshowAuto?b():d()};e.close=function(){if(q){q=false;c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(g);l.unbind(".cbox .cboxIE6");j.add(r).stop().fadeTo("fast",0,function(){c("#colorbox iframe").attr("src","about:blank");n.remove();j.add(r).css({opacity:1,cursor:"auto"}).hide();try{P.focus()}catch(b){}setTimeout(function(){c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(g)},1)})}};e.element=function(){return c(g)};e.settings=ba;c(e.init)})(jQuery);
+(function(c){function o(b,d){d=d==="x"?n.width():n.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function L(b){b=c.isFunction(b)?b.call(h):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Z(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(h);a.rel=a.rel||h.rel||"nofollow";a.href=a.href||c(h).attr("href");a.title=a.title||h.title}function $(b){h=b;a=c.extend({},c(h).data(s)); Z();if(a.rel!=="nofollow"){j=c(".cboxElement").filter(function(){return(c(this).data(s).rel||this.rel)===a.rel});g=j.index(h);if(g<0){j=j.add(h);g=j.length-1}}else{j=c(h);g=0}if(!q){A=q=l;M=h;try{M.blur()}catch(d){}c.event.trigger(ca);a.onOpen&&a.onOpen.call(h);r.css({opacity:parseFloat(a.opacity),cursor:a.overlayClose?"pointer":"auto"}).show();a.w=o(a.initialWidth,"x");a.h=o(a.initialHeight,"y");e.position(0);N&&n.bind("resize.cboxIE6 scroll.cboxIE6",function(){r.css({width:n.width(),height:n.height(), top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll.cboxIE6")}O.add(E).add(F).add(t).add(P).hide();Q.html(a.close).show();e.slideshow();e.load()}var s="colorbox",G="hover",l=true,e,B=c.browser.msie&&!c.support.opacity,N=B&&c.browser.version<7,ca="cbox_open",K="cbox_load",R="cbox_complete",r,k,x,p,S,T,U,V,j,n,m,H,I,P,O,t,F,E,Q,y,z,u,v,h,M,g,a,q,A,aa={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false, maxHeight:false,scalePhotos:l,scrolling:l,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:l,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:l,loop:l,slideshow:false,slideshowAuto:l,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,escKey:l,arrowKey:l};e=c.fn.colorbox=c.colorbox= function(b,d){var f=this;if(f.selector&&!f.length)return f;b=b||{};if(d)b.onComplete=d;if(!f.length||f.selector===undefined){f=c("<a/>");b.open=l}f.each(function(){c(this).data(s,c.extend({},c(this).data(s)||aa,b)).addClass("cboxElement")});b.open&&$(f[0]);return f};e.init=function(){function b(d){return c('<div id="cbox'+d+'"/>')}n=c(window);k=c('<div id="colorbox"/>');r=b("Overlay").hide();x=b("Wrapper");p=b("Content").append(m=b("LoadedContent").css({width:0,height:0}),I=b("LoadingOverlay").add(b("LoadingGraphic")), P=b("Title"),O=b("Current"),F=b("Next"),E=b("Previous"),t=b("Slideshow"),Q=b("Close"));x.append(c("<div/>").append(b("TopLeft"),S=b("TopCenter"),b("TopRight")),c("<div/>").append(T=b("MiddleLeft"),p,U=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),V=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"});H=c("<div id='cboxLoadingBay' style='position:absolute;'/>");c("body").prepend(r,k.append(x),H);if(B){k.addClass("cboxIE");N&&r.css("position","absolute")}p.children().bind("mouseover mouseout", function(){c(this).toggleClass(G)}).addClass(G);y=S.height()+V.height()+p.outerHeight(l)-p.height();z=T.width()+U.width()+p.outerWidth(l)-p.width();u=m.outerHeight(l);v=m.outerWidth(l);k.css({"padding-bottom":y,"padding-right":z}).hide();F.click(e.next);E.click(e.prev);Q.click(e.close);p.children().removeClass(G);c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined"||d.ctrlKey||d.shiftKey||d.altKey)return l;else{$(this);return false}});r.click(function(){a.overlayClose&& e.close()});c(document).bind("keydown",function(d){if(q&&a.escKey&&d.keyCode===27){d.preventDefault();e.close()}if(q&&a.arrowKey&&!A&&j.length>1)if(d.keyCode===37&&(g>0||a.loop)){d.preventDefault();E.click()}else if(d.keyCode===39&&(g<j.length-1||a.loop)){d.preventDefault();F.click()}})};e.remove=function(){k.add(r).add(H).remove();c(".cboxElement").removeData(s).removeClass("cboxElement")};e.position=function(b,d){function f(C){S[0].style.width=V[0].style.width=p[0].style.width=C.style.width;I[0].style.height= I[1].style.height=p[0].style.height=T[0].style.height=U[0].style.height=C.style.height}var i,w=Math.max(n.height()-a.h-u-y,0)/2+n.scrollTop(),J=Math.max(n.width()-a.w-v-z,0)/2+n.scrollLeft();i=k.width()===a.w+v&&k.height()===a.h+u?0:b;x[0].style.width=x[0].style.height="9999px";k.dequeue().animate({width:a.w+v,height:a.h+u,top:w,left:J},{duration:i,complete:function(){f(this);A=false;x[0].style.width=a.w+v+z+"px";x[0].style.height=a.h+u+y+"px";d&&d()},step:function(){f(this)}})};e.resize=function(b){if(q){b= b||{};if(b.width)a.w=o(b.width,"x")-v-z;if(b.innerWidth)a.w=o(b.innerWidth,"x");m.css({width:a.w});if(b.height)a.h=o(b.height,"y")-u-y;if(b.innerHeight)a.h=o(b.innerHeight,"y");if(!b.innerHeight&&!b.height){b=m.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}m.css({height:a.h});e.position(a.transition==="none"?0:a.speed)}};e.prep=function(b){function d(w){var J,C,W,X,D=j.length,Y=a.loop;e.position(w,function(){function ba(){B&&k[0].style.removeAttribute("filter")} if(q){B&&f&&m.fadeIn(100);if(a.iframe)c("<iframe frameborder=0"+(a.scrolling?"":" scrolling='no'")+(B?" allowtransparency='true'":"")+"/>").appendTo(m).attr({src:a.href,id:"cboxIframe",name:(new Date).getTime()});m.show();P.show().html(a.title);if(D>1){O.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,D)).show();F[Y||g<D-1?"show":"hide"]().html(a.next);E[Y||g>0?"show":"hide"]().html(a.prev);J=g>0?j[g-1]:j[D-1];W=g<D-1?j[g+1]:j[0];if(a.slideshow){t.show();g===D-1&&!Y&&k.is(".cboxSlideshow_on")&& t.click()}if(a.preloading){X=c(W).data(s).href||W.href;C=c(J).data(s).href||J.href;if(L(X))c("<img/>")[0].src=X;if(L(C))c("<img/>")[0].src=C}}I.hide();a.transition==="fade"?k.fadeTo(i,1,function(){ba()}):ba();n.bind("resize.cbox",function(){e.position(0)});c.event.trigger(R);a.onComplete&&a.onComplete.call(h)}})}if(q){var f,i=a.transition==="none"?0:a.speed;n.unbind("resize.cbox");m.remove();m=c('<div id="cboxLoadedContent"/>').html(b);m.hide().appendTo(H).css({width:function(){a.w=a.w||m.width(); a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?"auto":"hidden"}).css({height:function(){a.h=a.h||m.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});N&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition==="fade"&&k.fadeTo(i,0,function(){d(0)})||d(i)}};e.load=function(){var b,d,f,i=e.prep; A=l;h=j[g];a=c.extend({},c(h).data(s));Z();c.event.trigger(K);a.onLoad&&a.onLoad.call(h);a.h=a.height?o(a.height,"y")-u-y:a.innerHeight?o(a.innerHeight,"y"):false;a.w=a.width?o(a.width,"x")-v-z:a.innerWidth?o(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=o(a.maxWidth,"x")-v-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=o(a.maxHeight,"y")-u-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;I.show();if(a.inline){c('<div id="cboxInlineTemp"/>').hide().insertBefore(c(b)[0]).bind(K+" cbox_cleanup", function(){c(this).replaceWith(m.children())});i(c(b))}else if(a.iframe)i(" ");else if(a.html)i(a.html);else if(L(b)){d=new Image;d.onload=function(){var w;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){f=function(){d.height-=d.height*w;d.width-=d.width*w};if(a.mw&&d.width>a.mw){w=(d.width-a.mw)/d.width;f()}if(a.mh&&d.height>a.mh){w=(d.height-a.mh)/d.height;f()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";i(d); j.length>1&&c(d).css({cursor:"pointer"}).click(e.next);if(B)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div><p>Request unsuccessful.</p></div>").appendTo(H).load(b,function(){i(this)})};e.next=function(){if(!A){g=g<j.length-1?g+1:0;e.load()}};e.prev=function(){if(!A){g=g>0?g-1:j.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(R,function(){f=setTimeout(e.next,a.slideshowSpeed)}).bind(K,function(){clearTimeout(f)}).one("click",function(){d();c(this).removeClass(G)}); k.removeClass(i+"off").addClass(i+"on")}var d,f,i="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(f);k.removeClass(i+"off "+i+"on")});d=function(){clearTimeout(f);t.text(a.slideshowStart).unbind(R+" "+K).one("click",function(){b();f=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(G)});k.removeClass(i+"on").addClass(i+"off")};if(a.slideshow&&j.length>1)a.slideshowAuto?b():d()};e.close=function(){if(q){q=false;c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(h); n.unbind(".cbox .cboxIE6");k.add(r).stop().fadeTo("fast",0,function(){c("#colorbox iframe").attr("src","about:blank");m.remove();k.add(r).css({opacity:1,cursor:"auto"}).hide();try{M.focus()}catch(b){}setTimeout(function(){c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(h)},1)})}};e.element=function(){return c(h)};e.settings=aa;c(e.init)})(jQuery);
View
30 colorbox/jquery.colorbox.js
@@ -271,7 +271,7 @@
)
).children().children().css({'float': 'left'});
- $loadingBay = $("<div id='cboxLoadingBay' style='position:absolute; top:-200px; left:-200px; width:50px; height:50px; overflow:hidden;'/>");
+ $loadingBay = $("<div id='cboxLoadingBay' style='position:absolute;'/>");
$('body').prepend($overlay, $cbox.append($wrap), $loadingBay);
@@ -340,6 +340,11 @@
});
};
+
+ cboxPublic.remove = function(){
+ $cbox.add($overlay).add($loadingBay).remove();
+ $('.cboxElement').removeData(colorbox).removeClass('cboxElement');
+ }
cboxPublic.position = function (speed, loadedCallback) {
var
@@ -433,7 +438,7 @@
}
$loaded.hide()
- .appendTo($loadingBay)// content has to be appended to the DOM for accurate size calculations. Appended to an absolutely positioned element, rather than BODY, which avoids an extremely brief display of the vertical scrollbar in Firefox that can occur for a small minority of websites.
+ .appendTo('body')// content has to be appended to the DOM for accurate size calculations. Appended to an absolutely positioned element, rather than BODY, which avoids an extremely brief display of the vertical scrollbar in Firefox that can occur for a small minority of websites.
.css({width:getWidth(), overflow:settings.scrolling ? 'auto' : 'hidden'})
.css({height:getHeight()})// sets the height independently from the width in case the new width influences the value of height.
.prependTo($content);
@@ -452,19 +457,24 @@
function setPosition (s) {
var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop;
cboxPublic.position(s, function(){
+ function defilter(){
+ if(isIE){
+ //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
+ $cbox[0].style.removeAttribute("filter");
+ }
+ }
+
if (!open) { return; }
if (isIE) {
//This fadeIn helps the bicubic resampling to kick-in.
if( photo ){$loaded.fadeIn(100);}
- //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
- $cbox[0].style.removeAttribute("filter");
}
//Waited until the iframe is added to the DOM & it is visible before setting the src.
//This increases compatability with pages using DOM dependent JavaScript.
if(settings.iframe){
- $("<iframe frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + " />")
+ $("<iframe frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + "/>")
.appendTo($loaded)
.attr({src: settings.href, id: 'cboxIframe', name: new Date().getTime()});
}
@@ -495,11 +505,11 @@
prevSrc = $(prev).data(colorbox).href || prev.href;
if(isImage(nextSrc)){
- $('<img />')[0].src = nextSrc;
+ $('<img/>')[0].src = nextSrc;
}
if(isImage(prevSrc)){
- $('<img />')[0].src = prevSrc;
+ $('<img/>')[0].src = prevSrc;
}
}
}
@@ -508,8 +518,10 @@
if (settings.transition === 'fade'){
$cbox.fadeTo(speed, 1, function(){
- if(isIE){$cbox[0].style.removeAttribute("filter");}
+ defilter();
});
+ } else {
+ defilter();
}
$window.bind('resize.cbox', function(){
@@ -577,7 +589,7 @@
if (settings.inline) {
// Inserts an empty placeholder where inline content is being pulled from.
// An event is bound to put inline content back when ColorBox closes or loads new content.
- $('<div id="cboxInlineTemp" />').hide().insertBefore($(href)[0]).bind(cbox_load+' '+cbox_cleanup, function(){
+ $('<div id="cboxInlineTemp"/>').hide().insertBefore($(href)[0]).bind(cbox_load+' '+cbox_cleanup, function(){
$(this).replaceWith($loaded.children());
});
prep($(href));
Please sign in to comment.
Something went wrong with that request. Please try again.