annotate static/js/fancybox/jquery.fancybox-1.3.1.js @ 24:ead7bd49c9e0 django1.3

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