if (content) { this.objects.content.append(content); }
this._resetStyles();
this.objects.modal .removeClass() // add '.modal' back as it's been removed above (cannot just remove extraClasses, in cases where extraClasses have changed) .addClass(this.options.extraClasses ? 'modal ' + this.options.extraClasses : 'modal') .css(this._getPosition());
this.options.beforeOpen(this.objects); this.objects.modal.fadeIn(speed, function () {
// get natural height if (height === 'auto') { // ensure that if we set the width to maxWidth when calculating natural height // it's actually the smallest it'll ever be, i.e. the viewport might be smaller causing the content to be smaller var w = maxWidth > viewport.x ? viewport.x : maxWidth;
// if container width is auto or exceeds maxwidth set to maxwidth else set to container width this.objects.modal.width(maxWidth && width === 'auto' || maxWidth && width > maxWidth ? w : width); height = this.objects.modal.height(); this.objects.modal.width(''); }
// get natural width if (width === 'auto') { var h = maxHeight > viewport.y ? viewport.y : maxHeight; // we know here that height will bo longer be 'auto' this.objects.modal.height(maxHeight && height > maxHeight ? h : height); width = this.objects.modal.width(); this.objects.modal.height(''); }
// set old width to then calculate aspect (before it possibly gets skewed by maxwidth and maxheight) oldWidth = width; oldHeight = height;
// check aspect ratio if (options.keepAspect) { var h = height; // current height
height = oldHeight * width / oldWidth;
// if h is greater than height then adjust width instead if (height > h) { width = oldWidth * h / oldHeight; height = h; } }
if ($.isArray(this.options.position)) { top = this.options.position[0]; left = this.options.position[1]; } else { // set coords top = centreCoords.y - (height / 2); left = centreCoords.x - (width / 2);
// check popup doesn't display outisde of document if (!options.fitViewport) { top = top < scrollPos.y ? scrollPos.y : top; left = left < scrollPos.x ? scrollPos.x : left; } }
}); $(document).ready(function() { var divs = $('.mydivs>div'); var now = 0; // currently shown div divs.hide().first().show(); // hide all divs except first $("button[name=next]").click(function() { divs.eq(now).hide(); now = (now + 1 < divs.length) ? now + 1 : 0; divs.eq(now).show(); // show next }); $("button[name=prev]").click(function() { divs.eq(now).hide(); now = (now > 0) ? now - 1 : divs.length - 1; divs.eq(now).show(); // show previous }); }); })(jQuery);
// some IE6 nonsense (function ($, modal, undefined) {
if ($.browser.msie && $.browser.version.substr(0, 1) <= 6) {
var _events = modal._events, _open = modal._open, close = modal.close, selectBoxes;