annotate media/js/fancybox/jquery.fancybox-1.3.1.js @ 18:10be1f4f121b

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