annotate static/js/fancybox/jquery.fancybox-1.3.1.js @ 75:fa072915b52b

Update requirements.txt file.
author Brian Neal <bgneal@gmail.com>
date Sat, 14 Jul 2012 13:57:25 -0500
parents efb2da0b5d10
children
rev   line source
bgneal@26 1 /*
bgneal@26 2 * FancyBox - jQuery Plugin
bgneal@26 3 * Simple and fancy lightbox alternative
bgneal@26 4 *
bgneal@26 5 * Examples and documentation at: http://fancybox.net
bgneal@26 6 *
bgneal@26 7 * Copyright (c) 2008 - 2010 Janis Skarnelis
bgneal@26 8 *
bgneal@26 9 * Version: 1.3.1 (05/03/2010)
bgneal@26 10 * Requires: jQuery v1.3+
bgneal@26 11 *
bgneal@26 12 * Dual licensed under the MIT and GPL licenses:
bgneal@26 13 * http://www.opensource.org/licenses/mit-license.php
bgneal@26 14 * http://www.gnu.org/licenses/gpl.html
bgneal@26 15 */
bgneal@26 16
bgneal@26 17 (function($) {
bgneal@26 18
bgneal@26 19 var tmp, loading, overlay, wrap, outer, inner, close, nav_left, nav_right,
bgneal@26 20
bgneal@26 21 selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
bgneal@26 22
bgneal@26 23 ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
bgneal@26 24
bgneal@26 25 loadingTimer, loadingFrame = 1,
bgneal@26 26
bgneal@26 27 start_pos, final_pos, busy = false, shadow = 20, fx = $.extend($('<div/>')[0], { prop: 0 }), titleh = 0,
bgneal@26 28
bgneal@26 29 isIE6 = !$.support.opacity && !window.XMLHttpRequest,
bgneal@26 30
bgneal@26 31 /*
bgneal@26 32 * Private methods
bgneal@26 33 */
bgneal@26 34
bgneal@26 35 fancybox_abort = function() {
bgneal@26 36 loading.hide();
bgneal@26 37
bgneal@26 38 imgPreloader.onerror = imgPreloader.onload = null;
bgneal@26 39
bgneal@26 40 if (ajaxLoader) {
bgneal@26 41 ajaxLoader.abort();
bgneal@26 42 }
bgneal@26 43
bgneal@26 44 tmp.empty();
bgneal@26 45 },
bgneal@26 46
bgneal@26 47 fancybox_error = function() {
bgneal@26 48 $.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>', {
bgneal@26 49 'scrolling' : 'no',
bgneal@26 50 'padding' : 20,
bgneal@26 51 'transitionIn' : 'none',
bgneal@26 52 'transitionOut' : 'none'
bgneal@26 53 });
bgneal@26 54 },
bgneal@26 55
bgneal@26 56 fancybox_get_viewport = function() {
bgneal@26 57 return [ $(window).width(), $(window).height(), $(document).scrollLeft(), $(document).scrollTop() ];
bgneal@26 58 },
bgneal@26 59
bgneal@26 60 fancybox_get_zoom_to = function () {
bgneal@26 61 var view = fancybox_get_viewport(),
bgneal@26 62 to = {},
bgneal@26 63
bgneal@26 64 margin = currentOpts.margin,
bgneal@26 65 resize = currentOpts.autoScale,
bgneal@26 66
bgneal@26 67 horizontal_space = (shadow + margin) * 2,
bgneal@26 68 vertical_space = (shadow + margin) * 2,
bgneal@26 69 double_padding = (currentOpts.padding * 2),
bgneal@26 70
bgneal@26 71 ratio;
bgneal@26 72
bgneal@26 73 if (currentOpts.width.toString().indexOf('%') > -1) {
bgneal@26 74 to.width = ((view[0] * parseFloat(currentOpts.width)) / 100) - (shadow * 2) ;
bgneal@26 75 resize = false;
bgneal@26 76
bgneal@26 77 } else {
bgneal@26 78 to.width = currentOpts.width + double_padding;
bgneal@26 79 }
bgneal@26 80
bgneal@26 81 if (currentOpts.height.toString().indexOf('%') > -1) {
bgneal@26 82 to.height = ((view[1] * parseFloat(currentOpts.height)) / 100) - (shadow * 2);
bgneal@26 83 resize = false;
bgneal@26 84
bgneal@26 85 } else {
bgneal@26 86 to.height = currentOpts.height + double_padding;
bgneal@26 87 }
bgneal@26 88
bgneal@26 89 if (resize && (to.width > (view[0] - horizontal_space) || to.height > (view[1] - vertical_space))) {
bgneal@26 90 if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
bgneal@26 91 horizontal_space += double_padding;
bgneal@26 92 vertical_space += double_padding;
bgneal@26 93
bgneal@26 94 ratio = Math.min(Math.min( view[0] - horizontal_space, currentOpts.width) / currentOpts.width, Math.min( view[1] - vertical_space, currentOpts.height) / currentOpts.height);
bgneal@26 95
bgneal@26 96 to.width = Math.round(ratio * (to.width - double_padding)) + double_padding;
bgneal@26 97 to.height = Math.round(ratio * (to.height - double_padding)) + double_padding;
bgneal@26 98
bgneal@26 99 } else {
bgneal@26 100 to.width = Math.min(to.width, (view[0] - horizontal_space));
bgneal@26 101 to.height = Math.min(to.height, (view[1] - vertical_space));
bgneal@26 102 }
bgneal@26 103 }
bgneal@26 104
bgneal@26 105 to.top = view[3] + ((view[1] - (to.height + (shadow * 2 ))) * 0.5);
bgneal@26 106 to.left = view[2] + ((view[0] - (to.width + (shadow * 2 ))) * 0.5);
bgneal@26 107
bgneal@26 108 if (currentOpts.autoScale === false) {
bgneal@26 109 to.top = Math.max(view[3] + margin, to.top);
bgneal@26 110 to.left = Math.max(view[2] + margin, to.left);
bgneal@26 111 }
bgneal@26 112
bgneal@26 113 return to;
bgneal@26 114 },
bgneal@26 115
bgneal@26 116 fancybox_format_title = function(title) {
bgneal@26 117 if (title && title.length) {
bgneal@26 118 switch (currentOpts.titlePosition) {
bgneal@26 119 case 'inside':
bgneal@26 120 return title;
bgneal@26 121 case 'over':
bgneal@26 122 return '<span id="fancybox-title-over">' + title + '</span>';
bgneal@26 123 default:
bgneal@26 124 return '<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">' + title + '</span><span id="fancybox-title-right"></span></span>';
bgneal@26 125 }
bgneal@26 126 }
bgneal@26 127
bgneal@26 128 return false;
bgneal@26 129 },
bgneal@26 130
bgneal@26 131 fancybox_process_title = function() {
bgneal@26 132 var title = currentOpts.title,
bgneal@26 133 width = final_pos.width - (currentOpts.padding * 2),
bgneal@26 134 titlec = 'fancybox-title-' + currentOpts.titlePosition;
bgneal@26 135
bgneal@26 136 $('#fancybox-title').remove();
bgneal@26 137
bgneal@26 138 titleh = 0;
bgneal@26 139
bgneal@26 140 if (currentOpts.titleShow === false) {
bgneal@26 141 return;
bgneal@26 142 }
bgneal@26 143
bgneal@26 144 title = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(title, currentArray, currentIndex, currentOpts) : fancybox_format_title(title);
bgneal@26 145
bgneal@26 146 if (!title || title === '') {
bgneal@26 147 return;
bgneal@26 148 }
bgneal@26 149
bgneal@26 150 $('<div id="fancybox-title" class="' + titlec + '" />').css({
bgneal@26 151 'width' : width,
bgneal@26 152 'paddingLeft' : currentOpts.padding,
bgneal@26 153 'paddingRight' : currentOpts.padding
bgneal@26 154 }).html(title).appendTo('body');
bgneal@26 155
bgneal@26 156 switch (currentOpts.titlePosition) {
bgneal@26 157 case 'inside':
bgneal@26 158 titleh = $("#fancybox-title").outerHeight(true) - currentOpts.padding;
bgneal@26 159 final_pos.height += titleh;
bgneal@26 160 break;
bgneal@26 161
bgneal@26 162 case 'over':
bgneal@26 163 $('#fancybox-title').css('bottom', currentOpts.padding);
bgneal@26 164 break;
bgneal@26 165
bgneal@26 166 default:
bgneal@26 167 $('#fancybox-title').css('bottom', $("#fancybox-title").outerHeight(true) * -1);
bgneal@26 168 break;
bgneal@26 169 }
bgneal@26 170
bgneal@26 171 $('#fancybox-title').appendTo( outer ).hide();
bgneal@26 172 },
bgneal@26 173
bgneal@26 174 fancybox_set_navigation = function() {
bgneal@26 175 $(document).unbind('keydown.fb').bind('keydown.fb', function(e) {
bgneal@26 176 if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
bgneal@26 177 e.preventDefault();
bgneal@26 178 $.fancybox.close();
bgneal@26 179
bgneal@26 180 } else if (e.keyCode == 37) {
bgneal@26 181 e.preventDefault();
bgneal@26 182 $.fancybox.prev();
bgneal@26 183
bgneal@26 184 } else if (e.keyCode == 39) {
bgneal@26 185 e.preventDefault();
bgneal@26 186 $.fancybox.next();
bgneal@26 187 }
bgneal@26 188 });
bgneal@26 189
bgneal@26 190 if ($.fn.mousewheel) {
bgneal@26 191 wrap.unbind('mousewheel.fb');
bgneal@26 192
bgneal@26 193 if (currentArray.length > 1) {
bgneal@26 194 wrap.bind('mousewheel.fb', function(e, delta) {
bgneal@26 195 e.preventDefault();
bgneal@26 196
bgneal@26 197 if (busy || delta === 0) {
bgneal@26 198 return;
bgneal@26 199 }
bgneal@26 200
bgneal@26 201 if (delta > 0) {
bgneal@26 202 $.fancybox.prev();
bgneal@26 203 } else {
bgneal@26 204 $.fancybox.next();
bgneal@26 205 }
bgneal@26 206 });
bgneal@26 207 }
bgneal@26 208 }
bgneal@26 209
bgneal@26 210 if (!currentOpts.showNavArrows) { return; }
bgneal@26 211
bgneal@26 212 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
bgneal@26 213 nav_left.show();
bgneal@26 214 }
bgneal@26 215
bgneal@26 216 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
bgneal@26 217 nav_right.show();
bgneal@26 218 }
bgneal@26 219 },
bgneal@26 220
bgneal@26 221 fancybox_preload_images = function() {
bgneal@26 222 var href,
bgneal@26 223 objNext;
bgneal@26 224
bgneal@26 225 if ((currentArray.length -1) > currentIndex) {
bgneal@26 226 href = currentArray[ currentIndex + 1 ].href;
bgneal@26 227
bgneal@26 228 if (typeof href !== 'undefined' && href.match(imgRegExp)) {
bgneal@26 229 objNext = new Image();
bgneal@26 230 objNext.src = href;
bgneal@26 231 }
bgneal@26 232 }
bgneal@26 233
bgneal@26 234 if (currentIndex > 0) {
bgneal@26 235 href = currentArray[ currentIndex - 1 ].href;
bgneal@26 236
bgneal@26 237 if (typeof href !== 'undefined' && href.match(imgRegExp)) {
bgneal@26 238 objNext = new Image();
bgneal@26 239 objNext.src = href;
bgneal@26 240 }
bgneal@26 241 }
bgneal@26 242 },
bgneal@26 243
bgneal@26 244 _finish = function () {
bgneal@26 245 inner.css('overflow', (currentOpts.scrolling == 'auto' ? (currentOpts.type == 'image' || currentOpts.type == 'iframe' || currentOpts.type == 'swf' ? 'hidden' : 'auto') : (currentOpts.scrolling == 'yes' ? 'auto' : 'visible')));
bgneal@26 246
bgneal@26 247 if (!$.support.opacity) {
bgneal@26 248 inner.get(0).style.removeAttribute('filter');
bgneal@26 249 wrap.get(0).style.removeAttribute('filter');
bgneal@26 250 }
bgneal@26 251
bgneal@26 252 $('#fancybox-title').show();
bgneal@26 253
bgneal@26 254 if (currentOpts.hideOnContentClick) {
bgneal@26 255 inner.one('click', $.fancybox.close);
bgneal@26 256 }
bgneal@26 257 if (currentOpts.hideOnOverlayClick) {
bgneal@26 258 overlay.one('click', $.fancybox.close);
bgneal@26 259 }
bgneal@26 260
bgneal@26 261 if (currentOpts.showCloseButton) {
bgneal@26 262 close.show();
bgneal@26 263 }
bgneal@26 264
bgneal@26 265 fancybox_set_navigation();
bgneal@26 266
bgneal@26 267 $(window).bind("resize.fb", $.fancybox.center);
bgneal@26 268
bgneal@26 269 if (currentOpts.centerOnScroll) {
bgneal@26 270 $(window).bind("scroll.fb", $.fancybox.center);
bgneal@26 271 } else {
bgneal@26 272 $(window).unbind("scroll.fb");
bgneal@26 273 }
bgneal@26 274
bgneal@26 275 if ($.isFunction(currentOpts.onComplete)) {
bgneal@26 276 currentOpts.onComplete(currentArray, currentIndex, currentOpts);
bgneal@26 277 }
bgneal@26 278
bgneal@26 279 busy = false;
bgneal@26 280
bgneal@26 281 fancybox_preload_images();
bgneal@26 282 },
bgneal@26 283
bgneal@26 284 fancybox_draw = function(pos) {
bgneal@26 285 var width = Math.round(start_pos.width + (final_pos.width - start_pos.width) * pos),
bgneal@26 286 height = Math.round(start_pos.height + (final_pos.height - start_pos.height) * pos),
bgneal@26 287
bgneal@26 288 top = Math.round(start_pos.top + (final_pos.top - start_pos.top) * pos),
bgneal@26 289 left = Math.round(start_pos.left + (final_pos.left - start_pos.left) * pos);
bgneal@26 290
bgneal@26 291 wrap.css({
bgneal@26 292 'width' : width + 'px',
bgneal@26 293 'height' : height + 'px',
bgneal@26 294 'top' : top + 'px',
bgneal@26 295 'left' : left + 'px'
bgneal@26 296 });
bgneal@26 297
bgneal@26 298 width = Math.max(width - currentOpts.padding * 2, 0);
bgneal@26 299 height = Math.max(height - (currentOpts.padding * 2 + (titleh * pos)), 0);
bgneal@26 300
bgneal@26 301 inner.css({
bgneal@26 302 'width' : width + 'px',
bgneal@26 303 'height' : height + 'px'
bgneal@26 304 });
bgneal@26 305
bgneal@26 306 if (typeof final_pos.opacity !== 'undefined') {
bgneal@26 307 wrap.css('opacity', (pos < 0.5 ? 0.5 : pos));
bgneal@26 308 }
bgneal@26 309 },
bgneal@26 310
bgneal@26 311 fancybox_get_obj_pos = function(obj) {
bgneal@26 312 var pos = obj.offset();
bgneal@26 313
bgneal@26 314 pos.top += parseFloat( obj.css('paddingTop') ) || 0;
bgneal@26 315 pos.left += parseFloat( obj.css('paddingLeft') ) || 0;
bgneal@26 316
bgneal@26 317 pos.top += parseFloat( obj.css('border-top-width') ) || 0;
bgneal@26 318 pos.left += parseFloat( obj.css('border-left-width') ) || 0;
bgneal@26 319
bgneal@26 320 pos.width = obj.width();
bgneal@26 321 pos.height = obj.height();
bgneal@26 322
bgneal@26 323 return pos;
bgneal@26 324 },
bgneal@26 325
bgneal@26 326 fancybox_get_zoom_from = function() {
bgneal@26 327 var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
bgneal@26 328 from = {},
bgneal@26 329 pos,
bgneal@26 330 view;
bgneal@26 331
bgneal@26 332 if (orig && orig.length) {
bgneal@26 333 pos = fancybox_get_obj_pos(orig);
bgneal@26 334
bgneal@26 335 from = {
bgneal@26 336 width : (pos.width + (currentOpts.padding * 2)),
bgneal@26 337 height : (pos.height + (currentOpts.padding * 2)),
bgneal@26 338 top : (pos.top - currentOpts.padding - shadow),
bgneal@26 339 left : (pos.left - currentOpts.padding - shadow)
bgneal@26 340 };
bgneal@26 341
bgneal@26 342 } else {
bgneal@26 343 view = fancybox_get_viewport();
bgneal@26 344
bgneal@26 345 from = {
bgneal@26 346 width : 1,
bgneal@26 347 height : 1,
bgneal@26 348 top : view[3] + view[1] * 0.5,
bgneal@26 349 left : view[2] + view[0] * 0.5
bgneal@26 350 };
bgneal@26 351 }
bgneal@26 352
bgneal@26 353 return from;
bgneal@26 354 },
bgneal@26 355
bgneal@26 356 fancybox_show = function() {
bgneal@26 357 loading.hide();
bgneal@26 358
bgneal@26 359 if (wrap.is(":visible") && $.isFunction(currentOpts.onCleanup)) {
bgneal@26 360 if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) {
bgneal@26 361 $.event.trigger('fancybox-cancel');
bgneal@26 362
bgneal@26 363 busy = false;
bgneal@26 364 return;
bgneal@26 365 }
bgneal@26 366 }
bgneal@26 367
bgneal@26 368 currentArray = selectedArray;
bgneal@26 369 currentIndex = selectedIndex;
bgneal@26 370 currentOpts = selectedOpts;
bgneal@26 371
bgneal@26 372 inner.get(0).scrollTop = 0;
bgneal@26 373 inner.get(0).scrollLeft = 0;
bgneal@26 374
bgneal@26 375 if (currentOpts.overlayShow) {
bgneal@26 376 if (isIE6) {
bgneal@26 377 $('select:not(#fancybox-tmp select)').filter(function() {
bgneal@26 378 return this.style.visibility !== 'hidden';
bgneal@26 379 }).css({'visibility':'hidden'}).one('fancybox-cleanup', function() {
bgneal@26 380 this.style.visibility = 'inherit';
bgneal@26 381 });
bgneal@26 382 }
bgneal@26 383
bgneal@26 384 overlay.css({
bgneal@26 385 'background-color' : currentOpts.overlayColor,
bgneal@26 386 'opacity' : currentOpts.overlayOpacity
bgneal@26 387 }).unbind().show();
bgneal@26 388 }
bgneal@26 389
bgneal@26 390 final_pos = fancybox_get_zoom_to();
bgneal@26 391
bgneal@26 392 fancybox_process_title();
bgneal@26 393
bgneal@26 394 if (wrap.is(":visible")) {
bgneal@26 395 $( close.add( nav_left ).add( nav_right ) ).hide();
bgneal@26 396
bgneal@26 397 var pos = wrap.position(),
bgneal@26 398 equal;
bgneal@26 399
bgneal@26 400 start_pos = {
bgneal@26 401 top : pos.top ,
bgneal@26 402 left : pos.left,
bgneal@26 403 width : wrap.width(),
bgneal@26 404 height : wrap.height()
bgneal@26 405 };
bgneal@26 406
bgneal@26 407 equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
bgneal@26 408
bgneal@26 409 inner.fadeOut(currentOpts.changeFade, function() {
bgneal@26 410 var finish_resizing = function() {
bgneal@26 411 inner.html( tmp.contents() ).fadeIn(currentOpts.changeFade, _finish);
bgneal@26 412 };
bgneal@26 413
bgneal@26 414 $.event.trigger('fancybox-change');
bgneal@26 415
bgneal@26 416 inner.empty().css('overflow', 'hidden');
bgneal@26 417
bgneal@26 418 if (equal) {
bgneal@26 419 inner.css({
bgneal@26 420 top : currentOpts.padding,
bgneal@26 421 left : currentOpts.padding,
bgneal@26 422 width : Math.max(final_pos.width - (currentOpts.padding * 2), 1),
bgneal@26 423 height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1)
bgneal@26 424 });
bgneal@26 425
bgneal@26 426 finish_resizing();
bgneal@26 427
bgneal@26 428 } else {
bgneal@26 429 inner.css({
bgneal@26 430 top : currentOpts.padding,
bgneal@26 431 left : currentOpts.padding,
bgneal@26 432 width : Math.max(start_pos.width - (currentOpts.padding * 2), 1),
bgneal@26 433 height : Math.max(start_pos.height - (currentOpts.padding * 2), 1)
bgneal@26 434 });
bgneal@26 435
bgneal@26 436 fx.prop = 0;
bgneal@26 437
bgneal@26 438 $(fx).animate({ prop: 1 }, {
bgneal@26 439 duration : currentOpts.changeSpeed,
bgneal@26 440 easing : currentOpts.easingChange,
bgneal@26 441 step : fancybox_draw,
bgneal@26 442 complete : finish_resizing
bgneal@26 443 });
bgneal@26 444 }
bgneal@26 445 });
bgneal@26 446
bgneal@26 447 return;
bgneal@26 448 }
bgneal@26 449
bgneal@26 450 wrap.css('opacity', 1);
bgneal@26 451
bgneal@26 452 if (currentOpts.transitionIn == 'elastic') {
bgneal@26 453 start_pos = fancybox_get_zoom_from();
bgneal@26 454
bgneal@26 455 inner.css({
bgneal@26 456 top : currentOpts.padding,
bgneal@26 457 left : currentOpts.padding,
bgneal@26 458 width : Math.max(start_pos.width - (currentOpts.padding * 2), 1),
bgneal@26 459 height : Math.max(start_pos.height - (currentOpts.padding * 2), 1)
bgneal@26 460 })
bgneal@26 461 .html( tmp.contents() );
bgneal@26 462
bgneal@26 463 wrap.css(start_pos).show();
bgneal@26 464
bgneal@26 465 if (currentOpts.opacity) {
bgneal@26 466 final_pos.opacity = 0;
bgneal@26 467 }
bgneal@26 468
bgneal@26 469 fx.prop = 0;
bgneal@26 470
bgneal@26 471 $(fx).animate({ prop: 1 }, {
bgneal@26 472 duration : currentOpts.speedIn,
bgneal@26 473 easing : currentOpts.easingIn,
bgneal@26 474 step : fancybox_draw,
bgneal@26 475 complete : _finish
bgneal@26 476 });
bgneal@26 477
bgneal@26 478 } else {
bgneal@26 479 inner.css({
bgneal@26 480 top : currentOpts.padding,
bgneal@26 481 left : currentOpts.padding,
bgneal@26 482 width : Math.max(final_pos.width - (currentOpts.padding * 2), 1),
bgneal@26 483 height : Math.max(final_pos.height - (currentOpts.padding * 2) - titleh, 1)
bgneal@26 484 })
bgneal@26 485 .html( tmp.contents() );
bgneal@26 486
bgneal@26 487 wrap.css( final_pos ).fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
bgneal@26 488 }
bgneal@26 489 },
bgneal@26 490
bgneal@26 491 fancybox_process_inline = function() {
bgneal@26 492 tmp.width( selectedOpts.width );
bgneal@26 493 tmp.height( selectedOpts.height );
bgneal@26 494
bgneal@26 495 if (selectedOpts.width == 'auto') {
bgneal@26 496 selectedOpts.width = tmp.width();
bgneal@26 497 }
bgneal@26 498 if (selectedOpts.height == 'auto') {
bgneal@26 499 selectedOpts.height = tmp.height();
bgneal@26 500 }
bgneal@26 501
bgneal@26 502 fancybox_show();
bgneal@26 503 },
bgneal@26 504
bgneal@26 505 fancybox_process_image = function() {
bgneal@26 506 busy = true;
bgneal@26 507
bgneal@26 508 selectedOpts.width = imgPreloader.width;
bgneal@26 509 selectedOpts.height = imgPreloader.height;
bgneal@26 510
bgneal@26 511 $("<img />").attr({
bgneal@26 512 'id' : 'fancybox-img',
bgneal@26 513 'src' : imgPreloader.src,
bgneal@26 514 'alt' : selectedOpts.title
bgneal@26 515 }).appendTo( tmp );
bgneal@26 516
bgneal@26 517 fancybox_show();
bgneal@26 518 },
bgneal@26 519
bgneal@26 520 fancybox_start = function() {
bgneal@26 521 fancybox_abort();
bgneal@26 522
bgneal@26 523 var obj = selectedArray[ selectedIndex ],
bgneal@26 524 href,
bgneal@26 525 type,
bgneal@26 526 title,
bgneal@26 527 str,
bgneal@26 528 emb,
bgneal@26 529 selector,
bgneal@26 530 data;
bgneal@26 531
bgneal@26 532 selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
bgneal@26 533 title = obj.title || $(obj).title || selectedOpts.title || '';
bgneal@26 534
bgneal@26 535 if (obj.nodeName && !selectedOpts.orig) {
bgneal@26 536 selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
bgneal@26 537 }
bgneal@26 538
bgneal@26 539 if (title === '' && selectedOpts.orig) {
bgneal@26 540 title = selectedOpts.orig.attr('alt');
bgneal@26 541 }
bgneal@26 542
bgneal@26 543 if (obj.nodeName && (/^(?:javascript|#)/i).test(obj.href)) {
bgneal@26 544 href = selectedOpts.href || null;
bgneal@26 545 } else {
bgneal@26 546 href = selectedOpts.href || obj.href || null;
bgneal@26 547 }
bgneal@26 548
bgneal@26 549 if (selectedOpts.type) {
bgneal@26 550 type = selectedOpts.type;
bgneal@26 551
bgneal@26 552 if (!href) {
bgneal@26 553 href = selectedOpts.content;
bgneal@26 554 }
bgneal@26 555
bgneal@26 556 } else if (selectedOpts.content) {
bgneal@26 557 type = 'html';
bgneal@26 558
bgneal@26 559 } else if (href) {
bgneal@26 560 if (href.match(imgRegExp)) {
bgneal@26 561 type = 'image';
bgneal@26 562
bgneal@26 563 } else if (href.match(swfRegExp)) {
bgneal@26 564 type = 'swf';
bgneal@26 565
bgneal@26 566 } else if ($(obj).hasClass("iframe")) {
bgneal@26 567 type = 'iframe';
bgneal@26 568
bgneal@26 569 } else if (href.match(/#/)) {
bgneal@26 570 obj = href.substr(href.indexOf("#"));
bgneal@26 571
bgneal@26 572 type = $(obj).length > 0 ? 'inline' : 'ajax';
bgneal@26 573 } else {
bgneal@26 574 type = 'ajax';
bgneal@26 575 }
bgneal@26 576 } else {
bgneal@26 577 type = 'inline';
bgneal@26 578 }
bgneal@26 579
bgneal@26 580 selectedOpts.type = type;
bgneal@26 581 selectedOpts.href = href;
bgneal@26 582 selectedOpts.title = title;
bgneal@26 583
bgneal@26 584 if (selectedOpts.autoDimensions && selectedOpts.type !== 'iframe' && selectedOpts.type !== 'swf') {
bgneal@26 585 selectedOpts.width = 'auto';
bgneal@26 586 selectedOpts.height = 'auto';
bgneal@26 587 }
bgneal@26 588
bgneal@26 589 if (selectedOpts.modal) {
bgneal@26 590 selectedOpts.overlayShow = true;
bgneal@26 591 selectedOpts.hideOnOverlayClick = false;
bgneal@26 592 selectedOpts.hideOnContentClick = false;
bgneal@26 593 selectedOpts.enableEscapeButton = false;
bgneal@26 594 selectedOpts.showCloseButton = false;
bgneal@26 595 }
bgneal@26 596
bgneal@26 597 if ($.isFunction(selectedOpts.onStart)) {
bgneal@26 598 if (selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts) === false) {
bgneal@26 599 busy = false;
bgneal@26 600 return;
bgneal@26 601 }
bgneal@26 602 }
bgneal@26 603
bgneal@26 604 tmp.css('padding', (shadow + selectedOpts.padding + selectedOpts.margin));
bgneal@26 605
bgneal@26 606 $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
bgneal@26 607 $(this).replaceWith(inner.children());
bgneal@26 608 });
bgneal@26 609
bgneal@26 610 switch (type) {
bgneal@26 611 case 'html' :
bgneal@26 612 tmp.html( selectedOpts.content );
bgneal@26 613 fancybox_process_inline();
bgneal@26 614 break;
bgneal@26 615
bgneal@26 616 case 'inline' :
bgneal@26 617 $('<div class="fancybox-inline-tmp" />').hide().insertBefore( $(obj) ).bind('fancybox-cleanup', function() {
bgneal@26 618 $(this).replaceWith(inner.children());
bgneal@26 619 }).bind('fancybox-cancel', function() {
bgneal@26 620 $(this).replaceWith(tmp.children());
bgneal@26 621 });
bgneal@26 622
bgneal@26 623 $(obj).appendTo(tmp);
bgneal@26 624
bgneal@26 625 fancybox_process_inline();
bgneal@26 626 break;
bgneal@26 627
bgneal@26 628 case 'image':
bgneal@26 629 busy = false;
bgneal@26 630
bgneal@26 631 $.fancybox.showActivity();
bgneal@26 632
bgneal@26 633 imgPreloader = new Image();
bgneal@26 634
bgneal@26 635 imgPreloader.onerror = function() {
bgneal@26 636 fancybox_error();
bgneal@26 637 };
bgneal@26 638
bgneal@26 639 imgPreloader.onload = function() {
bgneal@26 640 imgPreloader.onerror = null;
bgneal@26 641 imgPreloader.onload = null;
bgneal@26 642 fancybox_process_image();
bgneal@26 643 };
bgneal@26 644
bgneal@26 645 imgPreloader.src = href;
bgneal@26 646
bgneal@26 647 break;
bgneal@26 648
bgneal@26 649 case 'swf':
bgneal@26 650 str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
bgneal@26 651 emb = '';
bgneal@26 652
bgneal@26 653 $.each(selectedOpts.swf, function(name, val) {
bgneal@26 654 str += '<param name="' + name + '" value="' + val + '"></param>';
bgneal@26 655 emb += ' ' + name + '="' + val + '"';
bgneal@26 656 });
bgneal@26 657
bgneal@26 658 str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
bgneal@26 659
bgneal@26 660 tmp.html(str);
bgneal@26 661
bgneal@26 662 fancybox_process_inline();
bgneal@26 663 break;
bgneal@26 664
bgneal@26 665 case 'ajax':
bgneal@26 666 selector = href.split('#', 2);
bgneal@26 667 data = selectedOpts.ajax.data || {};
bgneal@26 668
bgneal@26 669 if (selector.length > 1) {
bgneal@26 670 href = selector[0];
bgneal@26 671
bgneal@26 672 if (typeof data == "string") {
bgneal@26 673 data += '&selector=' + selector[1];
bgneal@26 674 } else {
bgneal@26 675 data.selector = selector[1];
bgneal@26 676 }
bgneal@26 677 }
bgneal@26 678
bgneal@26 679 busy = false;
bgneal@26 680 $.fancybox.showActivity();
bgneal@26 681
bgneal@26 682 ajaxLoader = $.ajax($.extend(selectedOpts.ajax, {
bgneal@26 683 url : href,
bgneal@26 684 data : data,
bgneal@26 685 error : fancybox_error,
bgneal@26 686 success : function(data, textStatus, XMLHttpRequest) {
bgneal@26 687 if (ajaxLoader.status == 200) {
bgneal@26 688 tmp.html( data );
bgneal@26 689 fancybox_process_inline();
bgneal@26 690 }
bgneal@26 691 }
bgneal@26 692 }));
bgneal@26 693
bgneal@26 694 break;
bgneal@26 695
bgneal@26 696 case 'iframe' :
bgneal@26 697 $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" scrolling="' + selectedOpts.scrolling + '" src="' + selectedOpts.href + '"></iframe>').appendTo(tmp);
bgneal@26 698 fancybox_show();
bgneal@26 699 break;
bgneal@26 700 }
bgneal@26 701 },
bgneal@26 702
bgneal@26 703 fancybox_animate_loading = function() {
bgneal@26 704 if (!loading.is(':visible')){
bgneal@26 705 clearInterval(loadingTimer);
bgneal@26 706 return;
bgneal@26 707 }
bgneal@26 708
bgneal@26 709 $('div', loading).css('top', (loadingFrame * -40) + 'px');
bgneal@26 710
bgneal@26 711 loadingFrame = (loadingFrame + 1) % 12;
bgneal@26 712 },
bgneal@26 713
bgneal@26 714 fancybox_init = function() {
bgneal@26 715 if ($("#fancybox-wrap").length) {
bgneal@26 716 return;
bgneal@26 717 }
bgneal@26 718
bgneal@26 719 $('body').append(
bgneal@26 720 tmp = $('<div id="fancybox-tmp"></div>'),
bgneal@26 721 loading = $('<div id="fancybox-loading"><div></div></div>'),
bgneal@26 722 overlay = $('<div id="fancybox-overlay"></div>'),
bgneal@26 723 wrap = $('<div id="fancybox-wrap"></div>')
bgneal@26 724 );
bgneal@26 725
bgneal@26 726 if (!$.support.opacity) {
bgneal@26 727 wrap.addClass('fancybox-ie');
bgneal@26 728 loading.addClass('fancybox-ie');
bgneal@26 729 }
bgneal@26 730
bgneal@26 731 outer = $('<div id="fancybox-outer"></div>')
bgneal@26 732 .append('<div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div>')
bgneal@26 733 .appendTo( wrap );
bgneal@26 734
bgneal@26 735 outer.append(
bgneal@26 736 inner = $('<div id="fancybox-inner"></div>'),
bgneal@26 737 close = $('<a id="fancybox-close"></a>'),
bgneal@26 738
bgneal@26 739 nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
bgneal@26 740 nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
bgneal@26 741 );
bgneal@26 742
bgneal@26 743 close.click($.fancybox.close);
bgneal@26 744 loading.click($.fancybox.cancel);
bgneal@26 745
bgneal@26 746 nav_left.click(function(e) {
bgneal@26 747 e.preventDefault();
bgneal@26 748 $.fancybox.prev();
bgneal@26 749 });
bgneal@26 750
bgneal@26 751 nav_right.click(function(e) {
bgneal@26 752 e.preventDefault();
bgneal@26 753 $.fancybox.next();
bgneal@26 754 });
bgneal@26 755
bgneal@26 756 if (isIE6) {
bgneal@26 757 overlay.get(0).style.setExpression('height', "document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");
bgneal@26 758 loading.get(0).style.setExpression('top', "(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");
bgneal@26 759
bgneal@26 760 outer.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>');
bgneal@26 761 }
bgneal@26 762 };
bgneal@26 763
bgneal@26 764 /*
bgneal@26 765 * Public methods
bgneal@26 766 */
bgneal@26 767
bgneal@26 768 $.fn.fancybox = function(options) {
bgneal@26 769 $(this)
bgneal@26 770 .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
bgneal@26 771 .unbind('click.fb').bind('click.fb', function(e) {
bgneal@26 772 e.preventDefault();
bgneal@26 773
bgneal@26 774 if (busy) {
bgneal@26 775 return;
bgneal@26 776 }
bgneal@26 777
bgneal@26 778 busy = true;
bgneal@26 779
bgneal@26 780 $(this).blur();
bgneal@26 781
bgneal@26 782 selectedArray = [];
bgneal@26 783 selectedIndex = 0;
bgneal@26 784
bgneal@26 785 var rel = $(this).attr('rel') || '';
bgneal@26 786
bgneal@26 787 if (!rel || rel == '' || rel === 'nofollow') {
bgneal@26 788 selectedArray.push(this);
bgneal@26 789
bgneal@26 790 } else {
bgneal@26 791 selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
bgneal@26 792 selectedIndex = selectedArray.index( this );
bgneal@26 793 }
bgneal@26 794
bgneal@26 795 fancybox_start();
bgneal@26 796
bgneal@26 797 return false;
bgneal@26 798 });
bgneal@26 799
bgneal@26 800 return this;
bgneal@26 801 };
bgneal@26 802
bgneal@26 803 $.fancybox = function(obj) {
bgneal@26 804 if (busy) {
bgneal@26 805 return;
bgneal@26 806 }
bgneal@26 807
bgneal@26 808 busy = true;
bgneal@26 809
bgneal@26 810 var opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
bgneal@26 811
bgneal@26 812 selectedArray = [];
bgneal@26 813 selectedIndex = opts.index || 0;
bgneal@26 814
bgneal@26 815 if ($.isArray(obj)) {
bgneal@26 816 for (var i = 0, j = obj.length; i < j; i++) {
bgneal@26 817 if (typeof obj[i] == 'object') {
bgneal@26 818 $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
bgneal@26 819 } else {
bgneal@26 820 obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
bgneal@26 821 }
bgneal@26 822 }
bgneal@26 823
bgneal@26 824 selectedArray = jQuery.merge(selectedArray, obj);
bgneal@26 825
bgneal@26 826 } else {
bgneal@26 827 if (typeof obj == 'object') {
bgneal@26 828 $(obj).data('fancybox', $.extend({}, opts, obj));
bgneal@26 829 } else {
bgneal@26 830 obj = $({}).data('fancybox', $.extend({content : obj}, opts));
bgneal@26 831 }
bgneal@26 832
bgneal@26 833 selectedArray.push(obj);
bgneal@26 834 }
bgneal@26 835
bgneal@26 836 if (selectedIndex > selectedArray.length || selectedIndex < 0) {
bgneal@26 837 selectedIndex = 0;
bgneal@26 838 }
bgneal@26 839
bgneal@26 840 fancybox_start();
bgneal@26 841 };
bgneal@26 842
bgneal@26 843 $.fancybox.showActivity = function() {
bgneal@26 844 clearInterval(loadingTimer);
bgneal@26 845
bgneal@26 846 loading.show();
bgneal@26 847 loadingTimer = setInterval(fancybox_animate_loading, 66);
bgneal@26 848 };
bgneal@26 849
bgneal@26 850 $.fancybox.hideActivity = function() {
bgneal@26 851 loading.hide();
bgneal@26 852 };
bgneal@26 853
bgneal@26 854 $.fancybox.next = function() {
bgneal@26 855 return $.fancybox.pos( currentIndex + 1);
bgneal@26 856 };
bgneal@26 857
bgneal@26 858 $.fancybox.prev = function() {
bgneal@26 859 return $.fancybox.pos( currentIndex - 1);
bgneal@26 860 };
bgneal@26 861
bgneal@26 862 $.fancybox.pos = function(pos) {
bgneal@26 863 if (busy) {
bgneal@26 864 return;
bgneal@26 865 }
bgneal@26 866
bgneal@26 867 pos = parseInt(pos, 10);
bgneal@26 868
bgneal@26 869 if (pos > -1 && currentArray.length > pos) {
bgneal@26 870 selectedIndex = pos;
bgneal@26 871 fancybox_start();
bgneal@26 872 }
bgneal@26 873
bgneal@26 874 if (currentOpts.cyclic && currentArray.length > 1 && pos < 0) {
bgneal@26 875 selectedIndex = currentArray.length - 1;
bgneal@26 876 fancybox_start();
bgneal@26 877 }
bgneal@26 878
bgneal@26 879 if (currentOpts.cyclic && currentArray.length > 1 && pos >= currentArray.length) {
bgneal@26 880 selectedIndex = 0;
bgneal@26 881 fancybox_start();
bgneal@26 882 }
bgneal@26 883
bgneal@26 884 return;
bgneal@26 885 };
bgneal@26 886
bgneal@26 887 $.fancybox.cancel = function() {
bgneal@26 888 if (busy) {
bgneal@26 889 return;
bgneal@26 890 }
bgneal@26 891
bgneal@26 892 busy = true;
bgneal@26 893
bgneal@26 894 $.event.trigger('fancybox-cancel');
bgneal@26 895
bgneal@26 896 fancybox_abort();
bgneal@26 897
bgneal@26 898 if (selectedOpts && $.isFunction(selectedOpts.onCancel)) {
bgneal@26 899 selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
bgneal@26 900 }
bgneal@26 901
bgneal@26 902 busy = false;
bgneal@26 903 };
bgneal@26 904
bgneal@26 905 // Note: within an iframe use - parent.$.fancybox.close();
bgneal@26 906 $.fancybox.close = function() {
bgneal@26 907 if (busy || wrap.is(':hidden')) {
bgneal@26 908 return;
bgneal@26 909 }
bgneal@26 910
bgneal@26 911 busy = true;
bgneal@26 912
bgneal@26 913 if (currentOpts && $.isFunction(currentOpts.onCleanup)) {
bgneal@26 914 if (currentOpts.onCleanup(currentArray, currentIndex, currentOpts) === false) {
bgneal@26 915 busy = false;
bgneal@26 916 return;
bgneal@26 917 }
bgneal@26 918 }
bgneal@26 919
bgneal@26 920 fancybox_abort();
bgneal@26 921
bgneal@26 922 $(close.add( nav_left ).add( nav_right )).hide();
bgneal@26 923
bgneal@26 924 $('#fancybox-title').remove();
bgneal@26 925
bgneal@26 926 wrap.add(inner).add(overlay).unbind();
bgneal@26 927
bgneal@26 928 $(window).unbind("resize.fb scroll.fb");
bgneal@26 929 $(document).unbind('keydown.fb');
bgneal@26 930
bgneal@26 931 function _cleanup() {
bgneal@26 932 overlay.fadeOut('fast');
bgneal@26 933
bgneal@26 934 wrap.hide();
bgneal@26 935
bgneal@26 936 $.event.trigger('fancybox-cleanup');
bgneal@26 937
bgneal@26 938 inner.empty();
bgneal@26 939
bgneal@26 940 if ($.isFunction(currentOpts.onClosed)) {
bgneal@26 941 currentOpts.onClosed(currentArray, currentIndex, currentOpts);
bgneal@26 942 }
bgneal@26 943
bgneal@26 944 currentArray = selectedOpts = [];
bgneal@26 945 currentIndex = selectedIndex = 0;
bgneal@26 946 currentOpts = selectedOpts = {};
bgneal@26 947
bgneal@26 948 busy = false;
bgneal@26 949 }
bgneal@26 950
bgneal@26 951 inner.css('overflow', 'hidden');
bgneal@26 952
bgneal@26 953 if (currentOpts.transitionOut == 'elastic') {
bgneal@26 954 start_pos = fancybox_get_zoom_from();
bgneal@26 955
bgneal@26 956 var pos = wrap.position();
bgneal@26 957
bgneal@26 958 final_pos = {
bgneal@26 959 top : pos.top ,
bgneal@26 960 left : pos.left,
bgneal@26 961 width : wrap.width(),
bgneal@26 962 height : wrap.height()
bgneal@26 963 };
bgneal@26 964
bgneal@26 965 if (currentOpts.opacity) {
bgneal@26 966 final_pos.opacity = 1;
bgneal@26 967 }
bgneal@26 968
bgneal@26 969 fx.prop = 1;
bgneal@26 970
bgneal@26 971 $(fx).animate({ prop: 0 }, {
bgneal@26 972 duration : currentOpts.speedOut,
bgneal@26 973 easing : currentOpts.easingOut,
bgneal@26 974 step : fancybox_draw,
bgneal@26 975 complete : _cleanup
bgneal@26 976 });
bgneal@26 977
bgneal@26 978 } else {
bgneal@26 979 wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
bgneal@26 980 }
bgneal@26 981 };
bgneal@26 982
bgneal@26 983 $.fancybox.resize = function() {
bgneal@26 984 var c, h;
bgneal@26 985
bgneal@26 986 if (busy || wrap.is(':hidden')) {
bgneal@26 987 return;
bgneal@26 988 }
bgneal@26 989
bgneal@26 990 busy = true;
bgneal@26 991
bgneal@26 992 c = inner.wrapInner("<div style='overflow:auto'></div>").children();
bgneal@26 993 h = c.height();
bgneal@26 994
bgneal@26 995 wrap.css({height: h + (currentOpts.padding * 2) + titleh});
bgneal@26 996 inner.css({height: h});
bgneal@26 997
bgneal@26 998 c.replaceWith(c.children());
bgneal@26 999
bgneal@26 1000 $.fancybox.center();
bgneal@26 1001 };
bgneal@26 1002
bgneal@26 1003 $.fancybox.center = function() {
bgneal@26 1004 busy = true;
bgneal@26 1005
bgneal@26 1006 var view = fancybox_get_viewport(),
bgneal@26 1007 margin = currentOpts.margin,
bgneal@26 1008 to = {};
bgneal@26 1009
bgneal@26 1010 to.top = view[3] + ((view[1] - ((wrap.height() - titleh) + (shadow * 2 ))) * 0.5);
bgneal@26 1011 to.left = view[2] + ((view[0] - (wrap.width() + (shadow * 2 ))) * 0.5);
bgneal@26 1012
bgneal@26 1013 to.top = Math.max(view[3] + margin, to.top);
bgneal@26 1014 to.left = Math.max(view[2] + margin, to.left);
bgneal@26 1015
bgneal@26 1016 wrap.css(to);
bgneal@26 1017
bgneal@26 1018 busy = false;
bgneal@26 1019 };
bgneal@26 1020
bgneal@26 1021 $.fn.fancybox.defaults = {
bgneal@26 1022 padding : 10,
bgneal@26 1023 margin : 20,
bgneal@26 1024 opacity : false,
bgneal@26 1025 modal : false,
bgneal@26 1026 cyclic : false,
bgneal@26 1027 scrolling : 'auto', // 'auto', 'yes' or 'no'
bgneal@26 1028
bgneal@26 1029 width : 560,
bgneal@26 1030 height : 340,
bgneal@26 1031
bgneal@26 1032 autoScale : true,
bgneal@26 1033 autoDimensions : true,
bgneal@26 1034 centerOnScroll : false,
bgneal@26 1035
bgneal@26 1036 ajax : {},
bgneal@26 1037 swf : { wmode: 'transparent' },
bgneal@26 1038
bgneal@26 1039 hideOnOverlayClick : true,
bgneal@26 1040 hideOnContentClick : false,
bgneal@26 1041
bgneal@26 1042 overlayShow : true,
bgneal@26 1043 overlayOpacity : 0.3,
bgneal@26 1044 overlayColor : '#666',
bgneal@26 1045
bgneal@26 1046 titleShow : true,
bgneal@26 1047 titlePosition : 'outside', // 'outside', 'inside' or 'over'
bgneal@26 1048 titleFormat : null,
bgneal@26 1049
bgneal@26 1050 transitionIn : 'fade', // 'elastic', 'fade' or 'none'
bgneal@26 1051 transitionOut : 'fade', // 'elastic', 'fade' or 'none'
bgneal@26 1052
bgneal@26 1053 speedIn : 300,
bgneal@26 1054 speedOut : 300,
bgneal@26 1055
bgneal@26 1056 changeSpeed : 300,
bgneal@26 1057 changeFade : 'fast',
bgneal@26 1058
bgneal@26 1059 easingIn : 'swing',
bgneal@26 1060 easingOut : 'swing',
bgneal@26 1061
bgneal@26 1062 showCloseButton : true,
bgneal@26 1063 showNavArrows : true,
bgneal@26 1064 enableEscapeButton : true,
bgneal@26 1065
bgneal@26 1066 onStart : null,
bgneal@26 1067 onCancel : null,
bgneal@26 1068 onComplete : null,
bgneal@26 1069 onCleanup : null,
bgneal@26 1070 onClosed : null
bgneal@26 1071 };
bgneal@26 1072
bgneal@26 1073 $(document).ready(function() {
bgneal@26 1074 fancybox_init();
bgneal@26 1075 });
bgneal@26 1076
bgneal@26 1077 })(jQuery);