ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

jquery.colorbox.js
Go to the documentation of this file.
1 // ColorBox v1.3.9 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
2 // c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
3 // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4 (function ($, window) {
5
6 var
7 // ColorBox Default Settings.
8 // See http://colorpowered.com/colorbox for details.
9 defaults = {
10 transition: "elastic",
11 speed: 300,
12 width: false,
13 initialWidth: "600",
14 innerWidth: false,
15 maxWidth: false,
16 height: false,
17 initialHeight: "450",
18 innerHeight: false,
19 maxHeight: false,
20 scalePhotos: true,
21 scrolling: true,
22 inline: false,
23 html: false,
24 iframe: false,
25 photo: false,
26 href: false,
27 title: false,
28 rel: false,
29 opacity: 0.9,
30 preloading: true,
31 current: "image {current} of {total}",
32 previous: "previous",
33 next: "next",
34 close: "close",
35 open: false,
36 loop: true,
37 slideshow: false,
38 slideshowAuto: true,
39 slideshowSpeed: 2500,
40 slideshowStart: "start slideshow",
41 slideshowStop: "stop slideshow",
42 onOpen: false,
43 onLoad: false,
44 onComplete: false,
45 onCleanup: false,
46 onClosed: false,
47 overlayClose: true,
48 escKey: true,
49 arrowKey: true
50 },
51
52 // Abstracting the HTML and event identifiers for easy rebranding
53 colorbox = 'colorbox',
54 prefix = 'cbox',
55
56 // Events
57 event_open = prefix + '_open',
58 event_load = prefix + '_load',
59 event_complete = prefix + '_complete',
60 event_cleanup = prefix + '_cleanup',
61 event_closed = prefix + '_closed',
62
63 // Special Handling for IE
64 isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome.
65 isIE6 = isIE && $.browser.version < 7,
66 event_ie6 = prefix + '_IE6',
67
68 // Cached jQuery Object Variables
69 $overlay,
70 $box,
71 $wrap,
72 $content,
73 $topBorder,
74 $leftBorder,
75 $rightBorder,
76 $bottomBorder,
77 $related,
78 $window,
79 $loaded,
80 $loadingBay,
81 $loadingOverlay,
82 $title,
83 $current,
84 $slideshow,
85 $next,
86 $prev,
87 $close,
88
89 // Variables for cached values or use across multiple functions
90 interfaceHeight,
91 interfaceWidth,
92 loadedHeight,
93 loadedWidth,
94 element,
95 bookmark,
96 index,
97 settings,
98 open,
99 active,
100
101 publicMethod,
102 boxElement = prefix + 'Element';
103
104 // ****************
105 // HELPER FUNCTIONS
106 // ****************
107
108 // jQuery object generator to reduce code size
109 function $div(id, css) {
110 id = id ? ' id="' + prefix + id + '"' : '';
111 css = css ? ' style="' + css + '"' : '';
112 return $('<div' + id + css + '/>');
113 }
114
115 // Convert % values to pixels
116 function setSize(size, dimension) {
117 dimension = dimension === 'x' ? $window.width() : $window.height();
118 return (typeof size === 'string') ? Math.round((size.match(/%/) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
119 }
120
121 // Checks an href to see if it is a photo.
122 // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
123 function isImage(url) {
124 url = $.isFunction(url) ? url.call(element) : url;
125 return settings.photo || url.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i);
126 }
127
128 // Assigns functions results to their respective settings. This allows functions to be used to set ColorBox options.
129 function process() {
130 for (var i in settings) {
131 if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
132 settings[i] = settings[i].call(element);
133 }
134 }
135 settings.rel = settings.rel || element.rel || 'nofollow';
136 settings.href = settings.href || $(element).attr('href');
137 settings.title = settings.title || element.title;
138 }
139
140 function launch(elem) {
141
142 element = elem;
143
144 settings = $.extend({}, $(element).data(colorbox));
145
146 process(); // Convert functions to their returned values.
147
148 if (settings.rel !== 'nofollow') {
149 $related = $('.' + boxElement).filter(function () {
150 var relRelated = $(this).data(colorbox).rel || this.rel;
151 return (relRelated === settings.rel);
152 });
153 index = $related.index(element);
154
155 // Check direct calls to ColorBox.
156 if (index === -1) {
157 $related = $related.add(element);
158 index = $related.length - 1;
159 }
160 } else {
161 $related = $(element);
162 index = 0;
163 }
164
165 if (!open) {
166 open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
167
168 bookmark = element;
169
170 try {
171 bookmark.blur(); // Remove the focus from the calling element.
172 }catch (e) {}
173
174 $.event.trigger(event_open);
175 if (settings.onOpen) {
176 settings.onOpen.call(element);
177 }
178
179 // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
180 $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
181
182 // Opens inital empty ColorBox prior to content being loaded.
183 settings.w = setSize(settings.initialWidth, 'x');
184 settings.h = setSize(settings.initialHeight, 'y');
185 publicMethod.position(0);
186
187 if (isIE6) {
188 $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
189 $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
190 }).trigger('scroll.' + event_ie6);
191 }
192 }
193
194 $current.add($prev).add($next).add($slideshow).add($title).hide();
195
196 $close.html(settings.close).show();
197
198 publicMethod.slideshow();
199
200 publicMethod.load();
201 }
202
203 // ****************
204 // PUBLIC FUNCTIONS
205 // Usage format: $.fn.colorbox.close();
206 // Usage from within an iframe: parent.$.fn.colorbox.close();
207 // ****************
208
209 publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
210 var $this = this;
211
212 if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
213 return $this;
214 }
215
216 options = options || {};
217
218 if (callback) {
219 options.onComplete = callback;
220 }
221
222 if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
223 $this = $('<a/>');
224 options.open = true; // assume an immediate open
225 }
226
227 $this.each(function () {
228 $(this).data(colorbox, $.extend({}, $(this).data(colorbox) || defaults, options)).addClass(boxElement);
229 });
230
231 if (options.open) {
232 launch($this[0]);
233 }
234
235 return $this;
236 };
237
238 // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
239 // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
240 // having to run once, instead of each time colorbox is opened.
241 publicMethod.init = function () {
242 // Create & Append jQuery Objects
243 $window = $(window);
244 $box = $div().attr({id: colorbox, 'class': isIE ? prefix + 'IE' : ''});
245 $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
246
247 $wrap = $div("Wrapper");
248 $content = $div("Content").append(
249 $loaded = $div("LoadedContent", 'width:0; height:0'),
250 $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
251 $title = $div("Title"),
252 $current = $div("Current"),
253 $next = $div("Next"),
254 $prev = $div("Previous"),
255 $slideshow = $div("Slideshow"),
256 $close = $div("Close")
257 );
258 $wrap.append( // The 3x3 Grid that makes up ColorBox
259 $div().append(
260 $div("TopLeft"),
261 $topBorder = $div("TopCenter"),
262 $div("TopRight")
263 ),
264 $div().append(
265 $leftBorder = $div("MiddleLeft"),
266 $content,
267 $rightBorder = $div("MiddleRight")
268 ),
269 $div().append(
270 $div("BottomLeft"),
271 $bottomBorder = $div("BottomCenter"),
272 $div("BottomRight")
273 )
274 ).children().children().css({'float': 'left'});
275
276 $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
277
278 $('body').prepend($overlay, $box.append($wrap, $loadingBay));
279
280 $content.children()
281 .hover(function () {
282 $(this).addClass('hover');
283 }, function () {
284 $(this).removeClass('hover');
285 }).addClass('hover');
286
287 // Cache values needed for size calculations
288 interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
289 interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
290 loadedHeight = $loaded.outerHeight(true);
291 loadedWidth = $loaded.outerWidth(true);
292
293 // Setting padding to remove the need to do size conversions during the animation step.
294 $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
295
296 // Setup button events.
297 $next.click(publicMethod.next);
298 $prev.click(publicMethod.prev);
299 $close.click(publicMethod.close);
300
301 // Adding the 'hover' class allowed the browser to load the hover-state
302 // background graphics. The class can now can be removed.
303 $content.children().removeClass('hover');
304
305 $('.' + boxElement).live('click', function (e) {
306 // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
307 if ((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey) {
308 return true;
309 } else {
310 launch(this);
311 return false;
312 }
313 });
314
315 $overlay.click(function () {
316 if (settings.overlayClose) {
317 publicMethod.close();
318 }
319 });
320
321 // Set Navigation Key Bindings
322 $(document).bind("keydown", function (e) {
323 if (open && settings.escKey && e.keyCode === 27) {
324 e.preventDefault();
325 publicMethod.close();
326 }
327 if (open && settings.arrowKey && !active && $related[1]) {
328 if (e.keyCode === 37 && (index || settings.loop)) {
329 e.preventDefault();
330 $prev.click();
331 } else if (e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) {
332 e.preventDefault();
333 $next.click();
334 }
335 }
336 });
337 };
338
339 publicMethod.remove = function () {
340 $box.add($overlay).remove();
341 $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
342 };
343
344 publicMethod.position = function (speed, loadedCallback) {
345 var
346 animate_speed,
347 // keeps the top and left positions within the browser's viewport.
348 posTop = Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
349 posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft();
350
351 // setting the speed to 0 to reduce the delay between same-sized content.
352 animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
353
354 // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
355 // but it has to be shrank down around the size of div#colorbox when it's done. If not,
356 // it can invoke an obscure IE bug when using iframes.
357 $wrap[0].style.width = $wrap[0].style.height = "9999px";
358
359 function modalDimensions(that) {
360 // loading overlay height has to be explicitly set for IE6.
361 $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
362 $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
363 }
364
365 $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
366 duration: animate_speed,
367 complete: function () {
368 modalDimensions(this);
369
370 active = false;
371
372 // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
373 $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
374 $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
375
376 if (loadedCallback) {
377 loadedCallback();
378 }
379 },
380 step: function () {
381 modalDimensions(this);
382 }
383 });
384 };
385
386 publicMethod.resize = function (options) {
387 if (open) {
388 options = options || {};
389
390 if (options.width) {
391 settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
392 }
393 if (options.innerWidth) {
394 settings.w = setSize(options.innerWidth, 'x');
395 }
396 $loaded.css({width: settings.w});
397
398 if (options.height) {
399 settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
400 }
401 if (options.innerHeight) {
402 settings.h = setSize(options.innerHeight, 'y');
403 }
404 if (!options.innerHeight && !options.height) {
405 var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
406 settings.h = $child.height();
407 $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
408 }
409 $loaded.css({height: settings.h});
410
411 publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
412 }
413 };
414
415 publicMethod.prep = function (object) {
416 if (!open) {
417 return;
418 }
419
420 var photo,
421 speed = settings.transition === "none" ? 0 : settings.speed;
422
423 $window.unbind('resize.' + prefix);
424 $loaded.remove();
425 $loaded = $div('LoadedContent').html(object);
426
427 function getWidth() {
428 settings.w = settings.w || $loaded.width();
429 settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
430 return settings.w;
431 }
432 function getHeight() {
433 settings.h = settings.h || $loaded.height();
434 settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
435 return settings.h;
436 }
437
438 $loaded.hide()
439 .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
440 .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
441 .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
442 .prependTo($content);
443
444 $loadingBay.hide();
445
446 $('#' + prefix + 'Photo').css({cssFloat: 'none'});// 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.
447
448 // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
449 if (isIE6) {
450 $('select').not($box.find('select')).filter(function () {
451 return this.style.visibility !== 'hidden';
452 }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
453 this.style.visibility = 'inherit';
454 });
455 }
456
457 function setPosition(s) {
458 var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop;
459 publicMethod.position(s, function () {
460 function defilter() {
461 if (isIE) {
462 //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
463 $box[0].style.removeAttribute("filter");
464 }
465 }
466
467 if (!open) {
468 return;
469 }
470
471 if (isIE) {
472 //This fadeIn helps the bicubic resampling to kick-in.
473 if (photo) {
474 $loaded.fadeIn(100);
475 }
476 }
477
478 //Waited until the iframe is added to the DOM & it is visible before setting the src.
479 //This increases compatability with pages using DOM dependent JavaScript.
480 if (settings.iframe) {
481 $("<iframe frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + "/>")
482 .attr({src: settings.href, name: new Date().getTime()})
483 .appendTo($loaded);
484 }
485
486 $loaded.show();
487
488 $title.show().html(settings.title);
489
490 if (total > 1) { // handle grouping
491 $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
492
493 $next[(loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
494 $prev[(loop || index) ? "show" : "hide"]().html(settings.previous);
495
496 prev = index ? $related[index - 1] : $related[total - 1];
497 next = index < total - 1 ? $related[index + 1] : $related[0];
498
499 if (settings.slideshow) {
500 $slideshow.show();
501 if (index === total - 1 && !loop && $box.is('.' + prefix + 'Slideshow_on')) {
502 $slideshow.click();
503 }
504 }
505
506 // Preloads images within a rel group
507 if (settings.preloading) {
508 nextSrc = $(next).data(colorbox).href || next.href;
509 prevSrc = $(prev).data(colorbox).href || prev.href;
510
511 if (isImage(nextSrc)) {
512 $('<img/>')[0].src = nextSrc;
513 }
514
515 if (isImage(prevSrc)) {
516 $('<img/>')[0].src = prevSrc;
517 }
518 }
519 }
520
521 $loadingOverlay.hide();
522
523 if (settings.transition === 'fade') {
524 $box.fadeTo(speed, 1, function () {
525 defilter();
526 });
527 } else {
528 defilter();
529 }
530
531 $window.bind('resize.' + prefix, function () {
532 publicMethod.position(0);
533 });
534
535 $.event.trigger(event_complete);
536 if (settings.onComplete) {
537 settings.onComplete.call(element);
538 }
539 });
540 }
541
542 if (settings.transition === 'fade') {
543 $box.fadeTo(speed, 0, function () {
544 setPosition(0);
545 });
546 } else {
547 setPosition(speed);
548 }
549 };
550
551 publicMethod.load = function () {
552 var href, img, setResize, prep = publicMethod.prep;
553
554 active = true;
555
556 element = $related[index];
557
558 settings = $.extend({}, $(element).data(colorbox));
559
560 //convert functions to static values
561 process();
562
563 $.event.trigger(event_load);
564 if (settings.onLoad) {
565 settings.onLoad.call(element);
566 }
567
568 settings.h = settings.height ?
569 setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
570 settings.innerHeight && setSize(settings.innerHeight, 'y');
571
572 settings.w = settings.width ?
573 setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
574 settings.innerWidth && setSize(settings.innerWidth, 'x');
575
576 // Sets the minimum dimensions for use in image scaling
577 settings.mw = settings.w;
578 settings.mh = settings.h;
579
580 // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
581 // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
582 if (settings.maxWidth) {
583 settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
584 settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
585 }
586 if (settings.maxHeight) {
587 settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
588 settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
589 }
590
591 href = settings.href;
592
593 $loadingOverlay.show();
594
595 if (settings.inline) {
596 // Inserts an empty placeholder where inline content is being pulled from.
597 // An event is bound to put inline content back when ColorBox closes or loads new content.
598 $div('InlineTemp').hide().insertBefore($(href)[0]).bind(event_load + ' ' + event_cleanup, function () {
599 $(this).replaceWith($loaded.children());
600 });
601 prep($(href));
602 } else if (settings.iframe) {
603 // IFrame element won't be added to the DOM until it is ready to be displayed,
604 // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
605 prep(" ");
606 } else if (settings.html) {
607 prep(settings.html);
608 } else if (isImage(href)) {
609 img = new Image();
610 img.onload = function () {
611 var percent;
612
613 img.onload = null;
614 img.id = prefix + 'Photo';
615 $(img).css({margin: 'auto', border: 'none', display: 'block', cssFloat: 'left'});
616
617 if (settings.scalePhotos) {
618 setResize = function () {
619 img.height -= img.height * percent;
620 img.width -= img.width * percent;
621 };
622 if (settings.mw && img.width > settings.mw) {
623 percent = (img.width - settings.mw) / img.width;
624 setResize();
625 }
626 if (settings.mh && img.height > settings.mh) {
627 percent = (img.height - settings.mh) / img.height;
628 setResize();
629 }
630 }
631
632 if (settings.h) {
633 img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px';
634 }
635
636 setTimeout(function () { // Chrome will sometimes report a 0 by 0 size if there isn't pause in execution
637 prep(img);
638 }, 1);
639
640 if ($related[1] && (index < $related.length - 1 || settings.loop)) {
641 $(img).css({cursor: 'pointer'}).click(publicMethod.next);
642 }
643
644 if (isIE) {
645 img.style.msInterpolationMode = 'bicubic';
646 }
647 };
648 img.src = href;
649 } else {
650 $div().appendTo($loadingBay).load(href, function (data, status, xhr) {
651 prep(status === 'error' ? 'Request unsuccessful: ' + xhr.statusText : this);
652 });
653 }
654 };
655
656 // Navigates to the next page/image in a set.
657 publicMethod.next = function () {
658 if (!active) {
659 index = index < $related.length - 1 ? index + 1 : 0;
660 publicMethod.load();
661 }
662 };
663
664 publicMethod.prev = function () {
665 if (!active) {
666 index = index ? index - 1 : $related.length - 1;
667 publicMethod.load();
668 }
669 };
670
671 publicMethod.slideshow = function () {
672 var stop, timeOut, className = prefix + 'Slideshow_';
673
674 $slideshow.bind(event_closed, function () {
675 $slideshow.unbind();
676 clearTimeout(timeOut);
677 $box.removeClass(className + "off " + className + "on");
678 });
679
680 function start() {
681 $slideshow
682 .text(settings.slideshowStop)
683 .bind(event_complete, function () {
684 timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
685 })
686 .bind(event_load, function () {
687 clearTimeout(timeOut);
688 }).one("click", function () {
689 stop();
690 });
691 $box.removeClass(className + "off").addClass(className + "on");
692 }
693
694 stop = function () {
695 clearTimeout(timeOut);
696 $slideshow
697 .text(settings.slideshowStart)
698 .unbind(event_complete + ' ' + event_load)
699 .one("click", function () {
700 start();
701 timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
702 });
703 $box.removeClass(className + "on").addClass(className + "off");
704 };
705
706 if (settings.slideshow && $related[1]) {
707 if (settings.slideshowAuto) {
708 start();
709 } else {
710 stop();
711 }
712 }
713 };
714
715 // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
716 publicMethod.close = function () {
717 if (open) {
718 open = false;
719
720 $.event.trigger(event_cleanup);
721
722 if (settings.onCleanup) {
723 settings.onCleanup.call(element);
724 }
725
726 $window.unbind('.' + prefix + ' .' + event_ie6);
727
728 $overlay.fadeTo('fast', 0);
729
730 $box.stop().fadeTo('fast', 0, function () {
731 $box.find('iframe').attr('src', 'about:blank'); // change the location of the iframe to avoid a problem in IE with flash objects not clearing.
732
733 $loaded.remove();
734
735 $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
736
737 try {
738 bookmark.focus();
739 } catch (e) {
740 // do nothing
741 }
742
743 setTimeout(function () {
744 $.event.trigger(event_closed);
745 if (settings.onClosed) {
746 settings.onClosed.call(element);
747 }
748 }, 1);
749 });
750 }
751 };
752
753 // A method for fetching the current element ColorBox is referencing.
754 // returns a jQuery object.
755 publicMethod.element = function () {
756 return $(element);
757 };
758
759 publicMethod.settings = defaults;
760
761 // Initializes ColorBox when the DOM has loaded
762 $(publicMethod.init);
763
764 }(jQuery, this));