8bb51511e2565710eb33dede601b4216a4c5913f
1 // ColorBox v1.3.20.1 - jQuery lightbox plugin
2 // (c) 2011 Jack Moore - jacklmoore.com
3 // License: http://www.opensource.org/licenses/mit-license.php
4 // + minWidth&minHeight support
5 // + colorbox_class support
6 (function ($, document
, window
) {
8 // Default settings object.
9 // See http://jacklmoore.com/colorbox for details.
11 transition
: "elastic",
36 current
: "image {current} of {total}",
40 xhrError
: "This content failed to load.",
41 imgError
: "This image failed to load.",
50 slideshowStart
: "start slideshow",
51 slideshowStop
: "stop slideshow",
68 // Abstracting the HTML and event identifiers for easy rebranding
69 colorbox
= 'colorbox',
70 colorbox_class
= 'box_mediabox box_modalbox',
72 boxElement
= prefix
+ 'Element',
75 event_open
= prefix
+ '_open',
76 event_load
= prefix
+ '_load',
77 event_complete
= prefix
+ '_complete',
78 event_cleanup
= prefix
+ '_cleanup',
79 event_closed
= prefix
+ '_closed',
80 event_purge
= prefix
+ '_purge',
82 // Special Handling for IE
83 isIE
= !$.support
.opacity
&& !$.support
.style
, // IE7 & IE8
84 isIE6
= isIE
&& !window
.XMLHttpRequest
, // IE6
85 event_ie6
= prefix
+ '_IE6',
87 // Cached jQuery Object Variables
109 // Variables for cached values or use across multiple functions
130 // Convience function for creating new jQuery objects
131 function $tag(tag
, id
, css
) {
132 var element
= document
.createElement(tag
);
135 element
.id
= prefix
+ id
;
139 element
.style
.cssText
= css
;
145 // Determine the next and previous members in a group.
146 function getIndex(increment
) {
148 max
= $related
.length
,
149 newIndex
= (index
+ increment
) % max
;
151 return (newIndex
< 0) ? max
+ newIndex
: newIndex
;
154 // Convert '%' and 'px' values to integers
155 function setSize(size
, dimension
) {
156 return Math
.round((/%/.test(size) ? ((dimension === 'x' ? winWidth() : winHeight()) / 100) : 1) * parseInt(size
, 10));
159 // Checks an href to see if it is a photo.
160 // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
161 function isImage(url
) {
162 return settings
.photo
|| /\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(url
);
165 function winWidth() {
166 // $(window).width() is incorrect for some mobile browsers, but
167 // window.innerWidth is unsupported in IE8 and lower.
168 return window
.innerWidth
|| $window
.width();
171 function winHeight() {
172 return window
.innerHeight
|| $window
.height();
175 // Assigns function results to their respective properties
176 function makeSettings() {
178 data
= $.data(element
, colorbox
);
181 settings
= $.extend({}, defaults
);
182 if (console
&& console
.log
) {
183 console
.log('Error: cboxElement missing settings object');
186 settings
= $.extend({}, data
);
189 for (i
in settings
) {
190 if ($.isFunction(settings
[i
]) && i
.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
191 settings
[i
] = settings
[i
].call(element
);
195 settings
.rel
= settings
.rel
|| element
.rel
|| $(element
).data('rel') || 'nofollow';
196 settings
.href
= settings
.href
|| $(element
).attr('href');
197 settings
.title
= settings
.title
|| element
.title
;
199 if (typeof settings
.href
=== "string") {
200 settings
.href
= $.trim(settings
.href
);
204 function trigger(event
, callback
) {
205 $.event
.trigger(event
);
207 callback
.call(element
);
211 // Slideshow functionality
212 function slideshow() {
215 className
= prefix
+ "Slideshow_",
216 click
= "click." + prefix
,
221 if (settings
.slideshow
&& $related
[1]) {
222 start = function () {
224 .text(settings
.slideshowStop
)
226 .bind(event_complete
, function () {
227 if (settings
.loop
|| $related
[index
+ 1]) {
228 timeOut
= setTimeout(publicMethod
.next
, settings
.slideshowSpeed
);
231 .bind(event_load
, function () {
232 clearTimeout(timeOut
);
234 .one(click
+ ' ' + event_cleanup
, stop
);
235 $box
.removeClass(className
+ "off").addClass(className
+ "on");
236 timeOut
= setTimeout(publicMethod
.next
, settings
.slideshowSpeed
);
240 clearTimeout(timeOut
);
242 .text(settings
.slideshowStart
)
243 .unbind([event_complete
, event_load
, event_cleanup
, click
].join(' '))
244 .one(click
, function () {
248 $box
.removeClass(className
+ "on").addClass(className
+ "off");
251 if (settings
.slideshowAuto
) {
257 $box
.removeClass(className
+ "off " + className
+ "on");
261 function launch(target
) {
268 $related
= $(element
);
272 if (settings
.rel
!== 'nofollow') {
273 $related
= $('.' + boxElement
).filter(function () {
274 var data
= $.data(this, colorbox
),
278 relRelated
= $(this).data('rel') || data
.rel
|| this.rel
;
281 return (relRelated
=== settings
.rel
);
283 index
= $related
.index(element
);
285 // Check direct calls to ColorBox.
287 $related
= $related
.add(element
);
288 index
= $related
.length
- 1;
293 open
= active
= true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
297 if (settings
.returnFocus
) {
298 $(element
).blur().one(event_closed
, function () {
303 // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
304 $overlay
.css({"opacity": +settings
.opacity
, "cursor": settings
.overlayClose
? "pointer" : "auto"}).show();
306 // Opens inital empty ColorBox prior to content being loaded.
307 settings
.w
= setSize(settings
.initialWidth
, 'x');
308 settings
.h
= setSize(settings
.initialHeight
, 'y');
309 publicMethod
.position();
312 $window
.bind('resize.' + event_ie6
+ ' scroll.' + event_ie6
, function () {
313 $overlay
.css({width
: winWidth(), height
: winHeight(), top
: $window
.scrollTop(), left
: $window
.scrollLeft()});
314 }).trigger('resize.' + event_ie6
);
317 trigger(event_open
, settings
.onOpen
);
319 $groupControls
.add($title
).hide();
321 $close
.html(settings
.close
).show();
324 publicMethod
.load(true);
328 // ColorBox's markup needs to be added to the DOM prior to being called
329 // so that the browser will go ahead and load the CSS background images.
330 function appendHTML() {
331 if (!$box
&& document
.body
) {
335 $box
= $tag(div
).attr({id
: colorbox
, 'class': (isIE
? prefix
+ (isIE6
? 'IE6' : 'IE') : '')+colorbox_class
}).hide();
336 $overlay
= $tag(div
, "Overlay", isIE6
? 'position:absolute' : '').hide();
337 $loadingOverlay
= $tag(div
, "LoadingOverlay").add($tag(div
, "LoadingGraphic"));
338 $wrap
= $tag(div
, "Wrapper");
339 $content
= $tag(div
, "Content").append(
340 $loaded
= $tag(div
, "LoadedContent", 'width:0; height:0; overflow:hidden'),
341 $title
= $tag(div
, "Title"),
342 $current
= $tag(div
, "Current"),
343 $next
= $tag(div
, "Next"),
344 $prev
= $tag(div
, "Previous"),
345 $slideshow
= $tag(div
, "Slideshow").bind(event_open
, slideshow
),
346 $close
= $tag(div
, "Close")
349 $wrap
.append( // The 3x3 Grid that makes up ColorBox
351 $tag(div
, "TopLeft"),
352 $topBorder
= $tag(div
, "TopCenter"),
353 $tag(div
, "TopRight")
355 $tag(div
, false, 'clear:left').append(
356 $leftBorder
= $tag(div
, "MiddleLeft"),
358 $rightBorder
= $tag(div
, "MiddleRight")
360 $tag(div
, false, 'clear:left').append(
361 $tag(div
, "BottomLeft"),
362 $bottomBorder
= $tag(div
, "BottomCenter"),
363 $tag(div
, "BottomRight")
365 ).find('div div').css({'float': 'left'});
367 $loadingBay
= $tag(div
, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
369 $groupControls
= $next
.add($prev
).add($current
).add($slideshow
);
371 $(document
.body
).append($overlay
, $box
.append($wrap
, $loadingBay
));
375 // Add ColorBox's event bindings
376 function addBindings() {
381 // Cache values needed for size calculations
382 interfaceHeight
= $topBorder
.height() + $bottomBorder
.height() + $content
.outerHeight(true) - $content
.height();//Subtraction needed for IE6
383 interfaceWidth
= $leftBorder
.width() + $rightBorder
.width() + $content
.outerWidth(true) - $content
.width();
384 loadedHeight
= $loaded
.outerHeight(true);
385 loadedWidth
= $loaded
.outerWidth(true);
387 // Setting padding to remove the need to do size conversions during the animation step.
388 $box
.css({"padding-bottom": interfaceHeight
, "padding-right": interfaceWidth
});
390 // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
391 $next
.click(function () {
394 $prev
.click(function () {
397 $close
.click(function () {
398 publicMethod
.close();
400 $overlay
.click(function () {
401 if (settings
.overlayClose
) {
402 publicMethod
.close();
407 $(document
).bind('keydown.' + prefix
, function (e
) {
409 if (open
&& settings
.escKey
&& key
=== 27) {
411 publicMethod
.close();
413 if (open
&& settings
.arrowKey
&& $related
[1]) {
417 } else if (key
=== 39) {
424 $('.' + boxElement
, document
).live('click', function (e
) {
425 // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
426 // See: http://jacklmoore.com/notes/click-events/
427 if (!(e
.which
> 1 || e
.shiftKey
|| e
.altKey
|| e
.metaKey
)) {
438 // Don't do anything if ColorBox already exists.
443 // Append the HTML when the DOM loads
449 // Usage format: $.fn.colorbox.close();
450 // Usage from within an iframe: parent.$.fn.colorbox.close();
453 publicMethod
= $.fn
[colorbox
] = $[colorbox
] = function (options
, callback
) {
456 options
= options
|| {};
462 if ($this.selector
) { // if a selector was given and it didn't match any elements, go ahead and exit.
465 // if no selector was given (ie. $.colorbox()), create a temporary element to work with
467 options
.open
= true; // assume an immediate open
471 options
.onComplete
= callback
;
474 $this.each(function () {
475 $.data(this, colorbox
, $.extend({}, $.data(this, colorbox
) || defaults
, options
));
476 var eltclass
= $(this).attr('class');
478 if (eltclass
.indexOf("boxWidth-")!==-1) {
479 var w
= eltclass
.match(/boxWidth-([^\s'">]*)/);
480 w
= w
[1].replace(/pc/,'%'); // % not allowed in html attribute ; use 100pc instead of 100%
481 $.data(this, colorbox
, $.extend($.data(this, colorbox
),{width
:w
}));
483 if (eltclass
.indexOf("boxHeight-")!==-1) {
484 var h
= eltclass
.match(/boxHeight-([^\s'">]*)/);
485 h
= h
[1].replace(/pc/,'%'); // % not allowed in html attribute ; use 100pc instead of 100%
486 $.data(this, colorbox
, $.extend($.data(this, colorbox
),{height
:h
}));
488 if (eltclass
.indexOf("boxIframe")!==-1) {
489 $.data(this, colorbox
, $.extend($.data(this, colorbox
),{iframe
:true}));
491 if (eltclass
.indexOf("boxInline")!==-1) {
492 $.data(this, colorbox
, $.extend($.data(this, colorbox
),{inline
:true}));
494 if (eltclass
.indexOf("boxSlideshow_off")!==-1) {
495 $.data(this, colorbox
, $.extend($.data(this, colorbox
),{slideshow
:false}));
498 }).addClass(boxElement
);
500 if (($.isFunction(options
.open
) && options
.open
.call($this)) || options
.open
) {
508 publicMethod
.position = function (speed
, loadedCallback
) {
513 offset
= $box
.offset(),
517 $window
.unbind('resize.' + prefix
);
519 // remove the modal so that it doesn't influence the document width/height
520 $box
.css({top
: -9e4
, left
: -9e4
});
522 scrollTop
= $window
.scrollTop();
523 scrollLeft
= $window
.scrollLeft();
525 if (settings
.fixed
&& !isIE6
) {
526 offset
.top
-= scrollTop
;
527 offset
.left
-= scrollLeft
;
528 $box
.css({position
: 'fixed'});
532 $box
.css({position
: 'absolute'});
535 // keeps the top and left positions within the browser's viewport.
536 if (settings
.right
!== false) {
537 left
+= Math
.max(winWidth() - settings
.w
- loadedWidth
- interfaceWidth
- setSize(settings
.right
, 'x'), 0);
538 } else if (settings
.left
!== false) {
539 left
+= setSize(settings
.left
, 'x');
541 left
+= Math
.round(Math
.max(winWidth() - settings
.w
- loadedWidth
- interfaceWidth
, 0) / 2);
544 if (settings
.bottom
!== false) {
545 top
+= Math
.max(winHeight() - settings
.h
- loadedHeight
- interfaceHeight
- setSize(settings
.bottom
, 'y'), 0);
546 } else if (settings
.top
!== false) {
547 top
+= setSize(settings
.top
, 'y');
549 top
+= Math
.round(Math
.max(winHeight() - settings
.h
- loadedHeight
- interfaceHeight
, 0) / 2);
552 $box
.css({top
: offset
.top
, left
: offset
.left
});
554 // setting the speed to 0 to reduce the delay between same-sized content.
555 speed
= ($box
.width() === settings
.w
+ loadedWidth
&& $box
.height() === settings
.h
+ loadedHeight
) ? 0 : speed
|| 0;
557 // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
558 // but it has to be shrank down around the size of div#colorbox when it's done. If not,
559 // it can invoke an obscure IE bug when using iframes.
560 $wrap
[0].style
.width
= $wrap
[0].style
.height
= "9999px";
562 function modalDimensions(that
) {
563 $topBorder
[0].style
.width
= $bottomBorder
[0].style
.width
= $content
[0].style
.width
= that
.style
.width
;
564 $content
[0].style
.height
= $leftBorder
[0].style
.height
= $rightBorder
[0].style
.height
= that
.style
.height
;
567 css
= {width
: settings
.w
+ loadedWidth
, height
: settings
.h
+ loadedHeight
, top
: top
, left
: left
};
568 if(speed
===0){ // temporary workaround to side-step jQuery-UI 1.8 bug (http://bugs.jquery.com/ticket/12273)
571 $box
.dequeue().animate(css
, {
573 complete: function () {
574 modalDimensions(this);
578 // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
579 $wrap
[0].style
.width
= (settings
.w
+ loadedWidth
+ interfaceWidth
) + "px";
580 $wrap
[0].style
.height
= (settings
.h
+ loadedHeight
+ interfaceHeight
) + "px";
582 if (settings
.reposition
) {
583 setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
584 $window
.bind('resize.' + prefix
, publicMethod
.position
);
588 if (loadedCallback
) {
593 modalDimensions(this);
598 publicMethod
.resize = function (options
) {
600 options
= options
|| {};
603 settings
.w
= setSize(options
.width
, 'x') - loadedWidth
- interfaceWidth
;
605 if (options
.innerWidth
) {
606 settings
.w
= setSize(options
.innerWidth
, 'x');
608 $loaded
.css({width
: settings
.w
});
610 if (options
.height
) {
611 settings
.h
= setSize(options
.height
, 'y') - loadedHeight
- interfaceHeight
;
613 if (options
.innerHeight
) {
614 settings
.h
= setSize(options
.innerHeight
, 'y');
616 if (!options
.innerHeight
&& !options
.height
) {
617 $loaded
.css({height
: "auto"});
618 settings
.h
= $loaded
.height();
620 $loaded
.css({height
: settings
.h
});
622 publicMethod
.position(settings
.transition
=== "none" ? 0 : settings
.speed
);
626 publicMethod
.prep = function (object
) {
631 var callback
, speed
= settings
.transition
=== "none" ? 0 : settings
.speed
;
634 $loaded
= $tag(div
, 'LoadedContent').append(object
);
636 function getWidth() {
637 settings
.w
= settings
.w
|| $loaded
.width();
638 settings
.w
= settings
.minw
&& settings
.minw
> settings
.w
? settings
.minw
: settings
.w
;
639 settings
.w
= settings
.mw
&& settings
.mw
< settings
.w
? settings
.mw
: settings
.w
;
642 function getHeight() {
643 settings
.h
= settings
.h
|| $loaded
.height();
644 settings
.h
= settings
.minh
&& settings
.minh
> settings
.h
? settings
.minh
: settings
.h
;
645 settings
.h
= settings
.mh
&& settings
.mh
< settings
.h
? settings
.mh
: settings
.h
;
650 .appendTo($loadingBay
.show())// content has to be appended to the DOM for accurate size calculations.
651 .css({width
: getWidth(), overflow
: settings
.scrolling
? 'auto' : 'hidden'})
652 .css({height
: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
653 .prependTo($content
);
657 // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
658 //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
660 $(photo
).css({'float': 'none'});
662 // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
664 $('select').not($box
.find('select')).filter(function () {
665 return this.style
.visibility
!== 'hidden';
666 }).css({'visibility': 'hidden'}).one(event_cleanup
, function () {
667 this.style
.visibility
= 'inherit';
671 callback = function () {
674 total
= $related
.length
,
676 frameBorder
= 'frameBorder',
677 allowTransparency
= 'allowTransparency',
687 function removeFilter() {
689 $box
[0].style
.removeAttribute('filter');
693 complete = function () {
694 clearTimeout(loadingTimer
);
695 // Detaching forces Andriod stock browser to redraw the area underneat the loading overlay. Hiding alone isn't enough.
696 $loadingOverlay
.detach().hide();
697 trigger(event_complete
, settings
.onComplete
);
701 //This fadeIn helps the bicubic resampling to kick-in.
707 $title
.html(settings
.title
).add($loaded
).show();
709 if (total
> 1) { // handle grouping
710 if (typeof settings
.current
=== "string") {
711 $current
.html(settings
.current
.replace('{current}', index
+ 1).replace('{total}', total
)).show();
714 $next
[(settings
.loop
|| index
< total
- 1) ? "show" : "hide"]().html(settings
.next
);
715 $prev
[(settings
.loop
|| index
) ? "show" : "hide"]().html(settings
.previous
);
717 if (settings
.slideshow
) {
721 // Preloads images within a rel group
722 if (settings
.preloading
) {
727 while (i
= $related
[preload
.pop()]) {
728 data
= $.data(i
, colorbox
);
730 if (data
&& data
.href
) {
732 if ($.isFunction(src
)) {
746 $groupControls
.hide();
749 if (settings
.iframe
) {
750 iframe
= $tag('iframe')[0];
752 if (frameBorder
in iframe
) {
753 iframe
[frameBorder
] = 0;
755 if (allowTransparency
in iframe
) {
756 iframe
[allowTransparency
] = "true";
758 // give the iframe a unique name to prevent caching
759 iframe
.name
= prefix
+ (+new Date());
760 if (settings
.fastIframe
) {
763 $(iframe
).one('load', complete
);
765 iframe
.src
= settings
.href
;
766 if (!settings
.scrolling
) {
767 iframe
.scrolling
= "no";
769 $(iframe
).addClass(prefix
+ 'Iframe').appendTo($loaded
).one(event_purge
, function () {
770 iframe
.src
= "//about:blank";
776 if (settings
.transition
=== 'fade') {
777 $box
.fadeTo(speed
, 1, removeFilter
);
783 if (settings
.transition
=== 'fade') {
784 $box
.fadeTo(speed
, 0, function () {
785 publicMethod
.position(0, callback
);
788 publicMethod
.position(speed
, callback
);
792 publicMethod
.load = function (launched
) {
793 var href
, setResize
, prep
= publicMethod
.prep
;
799 element
= $related
[index
];
805 trigger(event_purge
);
807 trigger(event_load
, settings
.onLoad
);
809 settings
.h
= settings
.height
?
810 setSize(settings
.height
, 'y') - loadedHeight
- interfaceHeight
:
811 settings
.innerHeight
&& setSize(settings
.innerHeight
, 'y');
813 settings
.w
= settings
.width
?
814 setSize(settings
.width
, 'x') - loadedWidth
- interfaceWidth
:
815 settings
.innerWidth
&& setSize(settings
.innerWidth
, 'x');
817 // Sets the minimum dimensions for use in image scaling
818 settings
.mw
= settings
.w
;
819 settings
.mh
= settings
.h
;
820 settings
.minw
= settings
.w
;
821 settings
.minh
= settings
.h
;
823 // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
824 // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
825 if (settings
.maxWidth
) {
826 settings
.mw
= setSize(settings
.maxWidth
, 'x') - loadedWidth
- interfaceWidth
;
827 settings
.mw
= settings
.w
&& settings
.w
< settings
.mw
? settings
.w
: settings
.mw
;
829 if(settings
.minWidth
){
830 settings
.minw
= setSize(settings
.minWidth
, 'x') - loadedWidth
- interfaceWidth
;
831 settings
.minw
= settings
.w
&& settings
.w
> settings
.minw
? settings
.w
: settings
.minw
;
833 if (settings
.maxHeight
) {
834 settings
.mh
= setSize(settings
.maxHeight
, 'y') - loadedHeight
- interfaceHeight
;
835 settings
.mh
= settings
.h
&& settings
.h
< settings
.mh
? settings
.h
: settings
.mh
;
837 if(settings
.minHeight
){
838 settings
.minh
= setSize(settings
.minHeight
, 'y') - loadedHeight
- interfaceHeight
;
839 settings
.minh
= settings
.h
&& settings
.h
> settings
.minh
? settings
.h
: settings
.minh
;
842 href
= settings
.href
;
844 loadingTimer
= setTimeout(function () {
845 $loadingOverlay
.show().appendTo($content
);
848 if (settings
.inline
) {
849 // Inserts an empty placeholder where inline content is being pulled from.
850 // An event is bound to put inline content back when ColorBox closes or loads new content.
851 $tag(div
).hide().insertBefore($(href
)[0]).one(event_purge
, function () {
852 $(this).replaceWith($loaded
.children());
855 } else if (settings
.iframe
) {
856 // IFrame element won't be added to the DOM until it is ready to be displayed,
857 // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
859 } else if (settings
.html
) {
861 } else if (isImage(href
)) {
862 $(photo
= new Image())
863 .addClass(prefix
+ 'Photo')
865 settings
.title
= false;
866 prep($tag(div
, 'Error').html(settings
.imgError
));
870 photo
.onload
= null; //stops animated gifs from firing the onload repeatedly.
872 if (settings
.scalePhotos
) {
873 setResize = function () {
874 photo
.height
-= photo
.height
* percent
;
875 photo
.width
-= photo
.width
* percent
;
877 if (settings
.mw
&& photo
.width
> settings
.mw
) {
878 percent
= (photo
.width
- settings
.mw
) / photo
.width
;
881 if (settings
.mh
&& photo
.height
> settings
.mh
) {
882 percent
= (photo
.height
- settings
.mh
) / photo
.height
;
888 photo
.style
.marginTop
= Math
.max(settings
.h
- photo
.height
, 0) / 2 + 'px';
891 if ($related
[1] && (settings
.loop
|| $related
[index
+ 1])) {
892 photo
.style
.cursor
= 'pointer';
893 photo
.onclick = function () {
899 photo
.style
.msInterpolationMode
= 'bicubic';
902 setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
907 setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
911 $loadingBay
.load(href
, settings
.data
, function (data
, status
, xhr
) {
912 prep(status
=== 'error' ? $tag(div
, 'Error').html(settings
.xhrError
) : $(this).contents());
917 // Navigates to the next page/image in a set.
918 publicMethod
.next = function () {
919 if (!active
&& $related
[1] && (settings
.loop
|| $related
[index
+ 1])) {
925 publicMethod
.prev = function () {
926 if (!active
&& $related
[1] && (settings
.loop
|| index
)) {
927 index
= getIndex(-1);
932 // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
933 publicMethod
.close = function () {
934 if (open
&& !closing
) {
940 trigger(event_cleanup
, settings
.onCleanup
);
942 $window
.unbind('.' + prefix
+ ' .' + event_ie6
);
944 $overlay
.fadeTo(200, 0);
946 $box
.stop().fadeTo(300, 0, function () {
948 $box
.add($overlay
).css({'opacity': 1, cursor
: 'auto'}).hide();
950 trigger(event_purge
);
954 setTimeout(function () {
956 trigger(event_closed
, settings
.onClosed
);
962 // Removes changes ColorBox made to the document, but does not remove the plugin
964 publicMethod
.remove = function () {
965 $([]).add($box
).add($overlay
).remove();
968 .removeData(colorbox
)
969 .removeClass(boxElement
)
973 // A method for fetching the current element ColorBox is referencing.
974 // returns a jQuery object.
975 publicMethod
.element = function () {
979 publicMethod
.settings
= defaults
;
981 }(jQuery
, document
, this));