Update ColorBox 1.4.3
This commit is contained in:
@@ -6,33 +6,39 @@
|
||||
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
||||
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
||||
#cboxContent{position:relative;}
|
||||
#cboxLoadedContent{overflow:auto;}
|
||||
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
|
||||
#cboxTitle{margin:0;}
|
||||
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
||||
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
||||
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width: none;}
|
||||
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
|
||||
.cboxIframe{width:100%; height:100%; display:block; border:0;}
|
||||
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box;}
|
||||
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
||||
|
||||
/*
|
||||
/*
|
||||
User Style:
|
||||
Change the following styles to modify the appearance of ColorBox. They are
|
||||
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
||||
*/
|
||||
#cboxOverlay{background:#000;}
|
||||
#colorbox{}
|
||||
#cboxContent{margin-top:20px;}
|
||||
#colorbox{outline:0;}
|
||||
#cboxContent{margin-top:20px;background:#000;}
|
||||
.cboxIframe{background:#fff;}
|
||||
#cboxError{padding:50px; border:1px solid #ccc;}
|
||||
#cboxLoadedContent{border:5px solid #000; background:#fff;}
|
||||
#cboxTitle{position:absolute; top:-20px; left:0; color:#ccc;}
|
||||
#cboxCurrent{position:absolute; top:-20px; right:0px; color:#ccc;}
|
||||
#cboxSlideshow{position:absolute; top:-20px; right:90px; color:#fff;}
|
||||
#cboxPrevious{position:absolute; top:50%; left:5px; margin-top:-32px; background:url(../images/controls.png) no-repeat top left; width:28px; height:65px; text-indent:-9999px;}
|
||||
#cboxPrevious:hover{background-position:bottom left;}
|
||||
#cboxNext{position:absolute; top:50%; right:5px; margin-top:-32px; background:url(../images/controls.png) no-repeat top right; width:28px; height:65px; text-indent:-9999px;}
|
||||
#cboxNext:hover{background-position:bottom right;}
|
||||
#cboxLoadingOverlay{background:#000;}
|
||||
#cboxLoadingGraphic{background:url(../images/loading.gif) no-repeat center center;}
|
||||
#cboxClose{position:absolute; top:5px; right:5px; display:block; background:url(../images/controls.png) no-repeat top center; width:38px; height:19px; text-indent:-9999px;}
|
||||
#cboxClose:hover{background-position:bottom center;}
|
||||
|
||||
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
||||
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
|
||||
|
||||
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
||||
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
|
||||
|
||||
#cboxSlideshow{position:absolute; top:-20px; right:90px; color:#fff;}
|
||||
#cboxPrevious{position:absolute; top:50%; left:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top left; width:28px; height:65px; text-indent:-9999px;}
|
||||
#cboxPrevious:hover{background-position:bottom left;}
|
||||
#cboxNext{position:absolute; top:50%; right:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top right; width:28px; height:65px; text-indent:-9999px;}
|
||||
#cboxNext:hover{background-position:bottom right;}
|
||||
#cboxClose{position:absolute; top:5px; right:5px; display:block; background:url(images/controls.png) no-repeat top center; width:38px; height:19px; text-indent:-9999px;}
|
||||
#cboxClose:hover{background-position:bottom center;}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// ColorBox v1.3.20.1 - jQuery lightbox plugin
|
||||
// (c) 2012 Jack Moore - jacklmoore.com
|
||||
// License: http://www.opensource.org/licenses/mit-license.php
|
||||
/*!
|
||||
jQuery ColorBox v1.4.3 - 2013-02-18
|
||||
(c) 2013 Jack Moore - jacklmoore.com/colorbox
|
||||
license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
(function ($, document, window) {
|
||||
var
|
||||
// Default settings object.
|
||||
@@ -28,7 +30,14 @@
|
||||
rel: false,
|
||||
opacity: 0.9,
|
||||
preloading: true,
|
||||
className: false,
|
||||
|
||||
// alternate image paths for high-res displays
|
||||
retinaImage: false,
|
||||
retinaUrl: false,
|
||||
retinaSuffix: '@2x.$1',
|
||||
|
||||
// internationalization
|
||||
current: "image {current} of {total}",
|
||||
previous: "previous",
|
||||
next: "next",
|
||||
@@ -45,6 +54,8 @@
|
||||
slideshowSpeed: 2500,
|
||||
slideshowStart: "start slideshow",
|
||||
slideshowStop: "stop slideshow",
|
||||
photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i,
|
||||
|
||||
onOpen: false,
|
||||
onLoad: false,
|
||||
onComplete: false,
|
||||
@@ -75,7 +86,7 @@
|
||||
event_purge = prefix + '_purge',
|
||||
|
||||
// Special Handling for IE
|
||||
isIE = !$.support.opacity && !$.support.style, // IE7 & IE8
|
||||
isIE = !$.support.leadingWhitespace, // IE6 to IE8
|
||||
isIE6 = isIE && !window.XMLHttpRequest, // IE6
|
||||
event_ie6 = prefix + '_IE6',
|
||||
|
||||
@@ -100,6 +111,7 @@
|
||||
$prev,
|
||||
$close,
|
||||
$groupControls,
|
||||
$events = $({}),
|
||||
|
||||
// Variables for cached values or use across multiple functions
|
||||
settings,
|
||||
@@ -116,6 +128,7 @@
|
||||
loadingTimer,
|
||||
publicMethod,
|
||||
div = "div",
|
||||
className,
|
||||
init;
|
||||
|
||||
// ****************
|
||||
@@ -148,23 +161,24 @@
|
||||
|
||||
// Convert '%' and 'px' values to integers
|
||||
function setSize(size, dimension) {
|
||||
return Math.round((/%/.test(size) ? ((dimension === 'x' ? winWidth() : winHeight()) / 100) : 1) * parseInt(size, 10));
|
||||
return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : $window.height()) / 100) : 1) * parseInt(size, 10));
|
||||
}
|
||||
|
||||
// Checks an href to see if it is a photo.
|
||||
// There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
|
||||
function isImage(url) {
|
||||
return settings.photo || /\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(url);
|
||||
}
|
||||
|
||||
function winWidth() {
|
||||
// $(window).width() is incorrect for some mobile browsers, but
|
||||
// window.innerWidth is unsupported in IE8 and lower.
|
||||
return window.innerWidth || $window.width();
|
||||
// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
|
||||
function isImage(settings, url) {
|
||||
return settings.photo || settings.photoRegex.test(url);
|
||||
}
|
||||
|
||||
function winHeight() {
|
||||
return window.innerHeight || $window.height();
|
||||
function retinaUrl(settings, url) {
|
||||
return settings.retinaUrl && window.devicePixelRatio > 1 ? url.replace(settings.photoRegex, settings.retinaSuffix) : url;
|
||||
}
|
||||
|
||||
function trapFocus(e) {
|
||||
if ('contains' in $box[0] && !$box[0].contains(e.target)) {
|
||||
e.stopPropagation();
|
||||
$box.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Assigns function results to their respective properties
|
||||
@@ -187,7 +201,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
settings.rel = settings.rel || element.rel || 'nofollow';
|
||||
settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow';
|
||||
settings.href = settings.href || $(element).attr('href');
|
||||
settings.title = settings.title || element.title;
|
||||
|
||||
@@ -197,8 +211,13 @@
|
||||
}
|
||||
|
||||
function trigger(event, callback) {
|
||||
$.event.trigger(event);
|
||||
if (callback) {
|
||||
// for external use
|
||||
$(document).trigger(event);
|
||||
|
||||
// for internal use
|
||||
$events.trigger(event);
|
||||
|
||||
if ($.isFunction(callback)) {
|
||||
callback.call(element);
|
||||
}
|
||||
}
|
||||
@@ -209,37 +228,52 @@
|
||||
timeOut,
|
||||
className = prefix + "Slideshow_",
|
||||
click = "click." + prefix,
|
||||
clear,
|
||||
set,
|
||||
start,
|
||||
stop,
|
||||
clear;
|
||||
stop;
|
||||
|
||||
if (settings.slideshow && $related[1]) {
|
||||
clear = function () {
|
||||
clearTimeout(timeOut);
|
||||
};
|
||||
|
||||
set = function () {
|
||||
if (settings.loop || $related[index + 1]) {
|
||||
timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
|
||||
}
|
||||
};
|
||||
|
||||
start = function () {
|
||||
$slideshow
|
||||
.text(settings.slideshowStop)
|
||||
.html(settings.slideshowStop)
|
||||
.unbind(click)
|
||||
.bind(event_complete, function () {
|
||||
if (settings.loop || $related[index + 1]) {
|
||||
timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
|
||||
}
|
||||
})
|
||||
.bind(event_load, function () {
|
||||
clearTimeout(timeOut);
|
||||
})
|
||||
.one(click + ' ' + event_cleanup, stop);
|
||||
.one(click, stop);
|
||||
|
||||
$events
|
||||
.bind(event_complete, set)
|
||||
.bind(event_load, clear)
|
||||
.bind(event_cleanup, stop);
|
||||
|
||||
$box.removeClass(className + "off").addClass(className + "on");
|
||||
timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
|
||||
};
|
||||
|
||||
stop = function () {
|
||||
clearTimeout(timeOut);
|
||||
clear();
|
||||
|
||||
$events
|
||||
.unbind(event_complete, set)
|
||||
.unbind(event_load, clear)
|
||||
.unbind(event_cleanup, stop);
|
||||
|
||||
$slideshow
|
||||
.text(settings.slideshowStart)
|
||||
.unbind([event_complete, event_load, event_cleanup, click].join(' '))
|
||||
.html(settings.slideshowStart)
|
||||
.unbind(click)
|
||||
.one(click, function () {
|
||||
publicMethod.next();
|
||||
start();
|
||||
});
|
||||
|
||||
$box.removeClass(className + "on").addClass(className + "off");
|
||||
};
|
||||
|
||||
@@ -270,7 +304,7 @@
|
||||
relRelated;
|
||||
|
||||
if (data) {
|
||||
relRelated = data.rel || this.rel;
|
||||
relRelated = $(this).data('rel') || data.rel || this.rel;
|
||||
}
|
||||
|
||||
return (relRelated === settings.rel);
|
||||
@@ -284,36 +318,65 @@
|
||||
}
|
||||
}
|
||||
|
||||
$overlay.css({
|
||||
opacity: parseFloat(settings.opacity),
|
||||
cursor: settings.overlayClose ? "pointer" : "auto",
|
||||
visibility: 'visible'
|
||||
}).show();
|
||||
|
||||
if (!open) {
|
||||
open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
|
||||
|
||||
$box.show();
|
||||
// Show colorbox so the sizes can be calculated in older versions of jQuery
|
||||
$box.css({visibility:'hidden', display:'block'});
|
||||
|
||||
if (settings.returnFocus) {
|
||||
$(element).blur().one(event_closed, function () {
|
||||
$(this).focus();
|
||||
});
|
||||
}
|
||||
$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden').appendTo($content);
|
||||
|
||||
// Cache values needed for size calculations
|
||||
interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
|
||||
interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
|
||||
loadedHeight = $loaded.outerHeight(true);
|
||||
loadedWidth = $loaded.outerWidth(true);
|
||||
|
||||
// +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
|
||||
$overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
|
||||
|
||||
// Opens inital empty ColorBox prior to content being loaded.
|
||||
settings.w = setSize(settings.initialWidth, 'x');
|
||||
settings.h = setSize(settings.initialHeight, 'y');
|
||||
publicMethod.position();
|
||||
|
||||
|
||||
if (isIE6) {
|
||||
$window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
|
||||
$overlay.css({width: winWidth(), height: winHeight(), top: $window.scrollTop(), left: $window.scrollLeft()});
|
||||
$overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
|
||||
}).trigger('resize.' + event_ie6);
|
||||
}
|
||||
|
||||
slideshow();
|
||||
|
||||
trigger(event_open, settings.onOpen);
|
||||
|
||||
$groupControls.add($title).hide();
|
||||
|
||||
$close.html(settings.close).show();
|
||||
|
||||
$box.focus();
|
||||
|
||||
// Confine focus to the modal
|
||||
// Uses event capturing that is not supported in IE8-
|
||||
if (document.addEventListener) {
|
||||
|
||||
document.addEventListener('focus', trapFocus, true);
|
||||
|
||||
$events.one(event_closed, function () {
|
||||
document.removeEventListener('focus', trapFocus, true);
|
||||
});
|
||||
}
|
||||
|
||||
// Return focus on closing
|
||||
if (settings.returnFocus) {
|
||||
$events.one(event_closed, function () {
|
||||
$(element).focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
publicMethod.load(true);
|
||||
@@ -327,18 +390,23 @@
|
||||
init = false;
|
||||
|
||||
$window = $(window);
|
||||
$box = $tag(div).attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}).hide();
|
||||
$box = $tag(div).attr({
|
||||
id: colorbox,
|
||||
'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : '',
|
||||
role: 'dialog',
|
||||
tabindex: '-1'
|
||||
}).hide();
|
||||
$overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide();
|
||||
$loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic"));
|
||||
$wrap = $tag(div, "Wrapper");
|
||||
$content = $tag(div, "Content").append(
|
||||
$loaded = $tag(div, "LoadedContent", 'width:0; height:0; overflow:hidden'),
|
||||
$title = $tag(div, "Title"),
|
||||
$current = $tag(div, "Current"),
|
||||
$next = $tag(div, "Next"),
|
||||
$prev = $tag(div, "Previous"),
|
||||
$slideshow = $tag(div, "Slideshow").bind(event_open, slideshow),
|
||||
$close = $tag(div, "Close")
|
||||
$prev = $tag('button', "Previous"),
|
||||
$next = $tag('button', "Next"),
|
||||
$slideshow = $tag('button', "Slideshow"),
|
||||
$loadingOverlay,
|
||||
$close = $tag('button', "Close")
|
||||
);
|
||||
|
||||
$wrap.append( // The 3x3 Grid that makes up ColorBox
|
||||
@@ -369,19 +437,19 @@
|
||||
|
||||
// Add ColorBox's event bindings
|
||||
function addBindings() {
|
||||
function clickHandler(e) {
|
||||
// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
|
||||
// See: http://jacklmoore.com/notes/click-events/
|
||||
if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
launch(this);
|
||||
}
|
||||
}
|
||||
|
||||
if ($box) {
|
||||
if (!init) {
|
||||
init = true;
|
||||
|
||||
// Cache values needed for size calculations
|
||||
interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
|
||||
interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
|
||||
loadedHeight = $loaded.outerHeight(true);
|
||||
loadedWidth = $loaded.outerWidth(true);
|
||||
|
||||
// Setting padding to remove the need to do size conversions during the animation step.
|
||||
$box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth});
|
||||
|
||||
// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
|
||||
$next.click(function () {
|
||||
publicMethod.next();
|
||||
@@ -405,7 +473,7 @@
|
||||
e.preventDefault();
|
||||
publicMethod.close();
|
||||
}
|
||||
if (open && settings.arrowKey && $related[1]) {
|
||||
if (open && settings.arrowKey && $related[1] && !e.altKey) {
|
||||
if (key === 37) {
|
||||
e.preventDefault();
|
||||
$prev.click();
|
||||
@@ -416,14 +484,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('.' + boxElement, document).live('click', function (e) {
|
||||
// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
|
||||
// See: http://jacklmoore.com/notes/click-events/
|
||||
if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
launch(this);
|
||||
}
|
||||
});
|
||||
if ($.isFunction($.fn.on)) {
|
||||
// For jQuery 1.7+
|
||||
$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
|
||||
} else {
|
||||
// For jQuery 1.3.x -> 1.6.x
|
||||
// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
|
||||
// This is not here for jQuery 1.9, it's here for legacy users.
|
||||
$('.'+boxElement).live('click.'+prefix, clickHandler);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -453,13 +522,11 @@
|
||||
appendHTML();
|
||||
|
||||
if (addBindings()) {
|
||||
if (!$this[0]) {
|
||||
if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
|
||||
return $this;
|
||||
}
|
||||
// if no selector was given (ie. $.colorbox()), create a temporary element to work with
|
||||
if ($.isFunction($this)) { // assume a call to $.colorbox
|
||||
$this = $('<a/>');
|
||||
options.open = true; // assume an immediate open
|
||||
options.open = true;
|
||||
} else if (!$this[0]) { // colorbox being applied to empty collection
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
@@ -507,22 +574,22 @@
|
||||
|
||||
// keeps the top and left positions within the browser's viewport.
|
||||
if (settings.right !== false) {
|
||||
left += Math.max(winWidth() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
|
||||
left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
|
||||
} else if (settings.left !== false) {
|
||||
left += setSize(settings.left, 'x');
|
||||
} else {
|
||||
left += Math.round(Math.max(winWidth() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
|
||||
left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
|
||||
}
|
||||
|
||||
if (settings.bottom !== false) {
|
||||
top += Math.max(winHeight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
|
||||
top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
|
||||
} else if (settings.top !== false) {
|
||||
top += setSize(settings.top, 'y');
|
||||
} else {
|
||||
top += Math.round(Math.max(winHeight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
|
||||
top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
|
||||
}
|
||||
|
||||
$box.css({top: offset.top, left: offset.left});
|
||||
$box.css({top: offset.top, left: offset.left, visibility:'visible'});
|
||||
|
||||
// setting the speed to 0 to reduce the delay between same-sized content.
|
||||
speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0;
|
||||
@@ -533,11 +600,12 @@
|
||||
$wrap[0].style.width = $wrap[0].style.height = "9999px";
|
||||
|
||||
function modalDimensions(that) {
|
||||
$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
|
||||
$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
|
||||
$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt(that.style.width,10) - interfaceWidth)+'px';
|
||||
$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt(that.style.height,10) - interfaceHeight)+'px';
|
||||
}
|
||||
|
||||
css = {width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left};
|
||||
css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
|
||||
|
||||
if(speed===0){ // temporary workaround to side-step jQuery-UI 1.8 bug (http://bugs.jquery.com/ticket/12273)
|
||||
$box.css(css);
|
||||
}
|
||||
@@ -602,8 +670,9 @@
|
||||
}
|
||||
|
||||
var callback, speed = settings.transition === "none" ? 0 : settings.speed;
|
||||
|
||||
$loaded.remove();
|
||||
|
||||
$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
|
||||
|
||||
$loaded = $tag(div, 'LoadedContent').append(object);
|
||||
|
||||
function getWidth() {
|
||||
@@ -626,30 +695,15 @@
|
||||
$loadingBay.hide();
|
||||
|
||||
// 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.
|
||||
//$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
|
||||
|
||||
$(photo).css({'float': 'none'});
|
||||
|
||||
// Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
|
||||
if (isIE6) {
|
||||
$('select').not($box.find('select')).filter(function () {
|
||||
return this.style.visibility !== 'hidden';
|
||||
}).css({'visibility': 'hidden'}).one(event_cleanup, function () {
|
||||
this.style.visibility = 'inherit';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
callback = function () {
|
||||
var preload,
|
||||
i,
|
||||
total = $related.length,
|
||||
var total = $related.length,
|
||||
iframe,
|
||||
frameBorder = 'frameBorder',
|
||||
allowTransparency = 'allowTransparency',
|
||||
complete,
|
||||
src,
|
||||
img,
|
||||
data;
|
||||
complete;
|
||||
|
||||
if (!open) {
|
||||
return;
|
||||
@@ -663,8 +717,7 @@
|
||||
|
||||
complete = function () {
|
||||
clearTimeout(loadingTimer);
|
||||
// Detaching forces Andriod stock browser to redraw the area underneat the loading overlay. Hiding alone isn't enough.
|
||||
$loadingOverlay.detach().hide();
|
||||
$loadingOverlay.hide();
|
||||
trigger(event_complete, settings.onComplete);
|
||||
};
|
||||
|
||||
@@ -691,27 +744,27 @@
|
||||
|
||||
// Preloads images within a rel group
|
||||
if (settings.preloading) {
|
||||
preload = [
|
||||
getIndex(-1),
|
||||
getIndex(1)
|
||||
];
|
||||
while (i = $related[preload.pop()]) {
|
||||
data = $.data(i, colorbox);
|
||||
|
||||
$.each([getIndex(-1), getIndex(1)], function(){
|
||||
var src,
|
||||
img,
|
||||
i = $related[this],
|
||||
data = $.data(i, colorbox);
|
||||
|
||||
if (data && data.href) {
|
||||
src = data.href;
|
||||
if ($.isFunction(src)) {
|
||||
src = src.call(i);
|
||||
}
|
||||
} else {
|
||||
src = i.href;
|
||||
src = $(i).attr('href');
|
||||
}
|
||||
|
||||
if (isImage(src)) {
|
||||
if (src && isImage(data, src)) {
|
||||
src = retinaUrl(data, src);
|
||||
img = new Image();
|
||||
img.src = src;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$groupControls.hide();
|
||||
@@ -723,23 +776,34 @@
|
||||
if (frameBorder in iframe) {
|
||||
iframe[frameBorder] = 0;
|
||||
}
|
||||
|
||||
if (allowTransparency in iframe) {
|
||||
iframe[allowTransparency] = "true";
|
||||
}
|
||||
// give the iframe a unique name to prevent caching
|
||||
iframe.name = prefix + (+new Date());
|
||||
if (settings.fastIframe) {
|
||||
complete();
|
||||
} else {
|
||||
$(iframe).one('load', complete);
|
||||
}
|
||||
iframe.src = settings.href;
|
||||
|
||||
if (!settings.scrolling) {
|
||||
iframe.scrolling = "no";
|
||||
}
|
||||
$(iframe).addClass(prefix + 'Iframe').appendTo($loaded).one(event_purge, function () {
|
||||
|
||||
$(iframe)
|
||||
.attr({
|
||||
src: settings.href,
|
||||
name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
|
||||
'class': prefix + 'Iframe',
|
||||
allowFullScreen : true, // allow HTML5 video to go fullscreen
|
||||
webkitAllowFullScreen : true,
|
||||
mozallowfullscreen : true
|
||||
})
|
||||
.one('load', complete)
|
||||
.appendTo($loaded);
|
||||
|
||||
$events.one(event_purge, function () {
|
||||
iframe.src = "//about:blank";
|
||||
});
|
||||
|
||||
if (settings.fastIframe) {
|
||||
$(iframe).trigger('load');
|
||||
}
|
||||
} else {
|
||||
complete();
|
||||
}
|
||||
@@ -761,7 +825,7 @@
|
||||
};
|
||||
|
||||
publicMethod.load = function (launched) {
|
||||
var href, setResize, prep = publicMethod.prep;
|
||||
var href, setResize, prep = publicMethod.prep, $inline;
|
||||
|
||||
active = true;
|
||||
|
||||
@@ -772,6 +836,14 @@
|
||||
if (!launched) {
|
||||
makeSettings();
|
||||
}
|
||||
|
||||
if (className) {
|
||||
$box.add($overlay).removeClass(className);
|
||||
}
|
||||
if (settings.className) {
|
||||
$box.add($overlay).addClass(settings.className);
|
||||
}
|
||||
className = settings.className;
|
||||
|
||||
trigger(event_purge);
|
||||
|
||||
@@ -803,15 +875,18 @@
|
||||
href = settings.href;
|
||||
|
||||
loadingTimer = setTimeout(function () {
|
||||
$loadingOverlay.show().appendTo($content);
|
||||
$loadingOverlay.show();
|
||||
}, 100);
|
||||
|
||||
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.
|
||||
$tag(div).hide().insertBefore($(href)[0]).one(event_purge, function () {
|
||||
$(this).replaceWith($loaded.children());
|
||||
$inline = $tag(div).hide().insertBefore($(href)[0]);
|
||||
|
||||
$events.one(event_purge, function () {
|
||||
$inline.replaceWith($loaded.children());
|
||||
});
|
||||
|
||||
prep($(href));
|
||||
} else if (settings.iframe) {
|
||||
// IFrame element won't be added to the DOM until it is ready to be displayed,
|
||||
@@ -819,17 +894,24 @@
|
||||
prep(" ");
|
||||
} else if (settings.html) {
|
||||
prep(settings.html);
|
||||
} else if (isImage(href)) {
|
||||
} else if (isImage(settings, href)) {
|
||||
|
||||
href = retinaUrl(settings, href);
|
||||
|
||||
$(photo = new Image())
|
||||
.addClass(prefix + 'Photo')
|
||||
.error(function () {
|
||||
.bind('error',function () {
|
||||
settings.title = false;
|
||||
prep($tag(div, 'Error').html(settings.imgError));
|
||||
})
|
||||
.load(function () {
|
||||
.one('load', function () {
|
||||
var percent;
|
||||
photo.onload = null; //stops animated gifs from firing the onload repeatedly.
|
||||
|
||||
|
||||
if (settings.retinaImage && window.devicePixelRatio > 1) {
|
||||
photo.height = photo.height / window.devicePixelRatio;
|
||||
photo.width = photo.width / window.devicePixelRatio;
|
||||
}
|
||||
|
||||
if (settings.scalePhotos) {
|
||||
setResize = function () {
|
||||
photo.height -= photo.height * percent;
|
||||
@@ -846,7 +928,7 @@
|
||||
}
|
||||
|
||||
if (settings.h) {
|
||||
photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
|
||||
photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
|
||||
}
|
||||
|
||||
if ($related[1] && (settings.loop || $related[index + 1])) {
|
||||
@@ -869,7 +951,7 @@
|
||||
photo.src = href;
|
||||
}, 1);
|
||||
} else if (href) {
|
||||
$loadingBay.load(href, settings.data, function (data, status, xhr) {
|
||||
$loadingBay.load(href, settings.data, function (data, status) {
|
||||
prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents());
|
||||
});
|
||||
}
|
||||
@@ -910,7 +992,7 @@
|
||||
|
||||
trigger(event_purge);
|
||||
|
||||
$loaded.remove();
|
||||
$loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
|
||||
|
||||
setTimeout(function () {
|
||||
closing = false;
|
||||
@@ -927,8 +1009,9 @@
|
||||
$box = null;
|
||||
$('.' + boxElement)
|
||||
.removeData(colorbox)
|
||||
.removeClass(boxElement)
|
||||
.die();
|
||||
.removeClass(boxElement);
|
||||
|
||||
$(document).unbind('click.'+prefix);
|
||||
};
|
||||
|
||||
// A method for fetching the current element ColorBox is referencing.
|
||||
@@ -939,4 +1022,4 @@
|
||||
|
||||
publicMethod.settings = defaults;
|
||||
|
||||
}(jQuery, document, this));
|
||||
}(jQuery, document, window));
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user