Skip to content

Commit

Permalink
Updated to V2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyapps committed Oct 23, 2012
1 parent e50c0d8 commit cd2bc9a
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 86 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
fancyBox - Changelog
=========

### Version 2.1.3 - October 23, 2012

* Fixed #426 - Broken IE7
* Fixed #423 - Background flickering on iOS
* Fixed #418 - Automatically Grow/Shrink and Center
* Updated the script to work with jQuery 1.6
* Media helper supports YouTube video series

### Version 2.1.2 - October 15, 2012

* Fixed #414 - Don't allow nextClick if there is only one item
Expand Down
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script type="text/javascript" src="../lib/jquery.mousewheel-3.0.6.pack.js"></script>

<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="../source/jquery.fancybox.js?v=2.1.2"></script>
<script type="text/javascript" src="../source/jquery.fancybox.js?v=2.1.3"></script>
<link rel="stylesheet" type="text/css" href="../source/jquery.fancybox.css?v=2.1.2" media="screen" />

<!-- Add Button helper (this is optional) -->
Expand All @@ -23,7 +23,7 @@
<script type="text/javascript" src="../source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>

<!-- Add Media helper (this is optional) -->
<script type="text/javascript" src="../source/helpers/jquery.fancybox-media.js?v=1.0.4"></script>
<script type="text/javascript" src="../source/helpers/jquery.fancybox-media.js?v=1.0.5"></script>

<script type="text/javascript">
$(document).ready(function() {
Expand Down
4 changes: 2 additions & 2 deletions source/helpers/jquery.fancybox-media.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Media helper for fancyBox
* version: 1.0.4 (Mon, 01 Oct 2012)
* version: 1.0.5 (Tue, 23 Oct 2012)
* @requires fancyBox v2.0 or later
*
* Usage:
Expand Down Expand Up @@ -88,7 +88,7 @@
F.helpers.media = {
defaults : {
youtube : {
matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
params : {
autoplay : 1,
autohide : 1,
Expand Down
9 changes: 6 additions & 3 deletions source/jquery.fancybox.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! fancyBox v2.1.2 fancyapps.com | fancyapps.com/fancybox/#license */
/*! fancyBox v2.1.3 fancyapps.com | fancyapps.com/fancybox/#license */
.fancybox-wrap,
.fancybox-skin,
.fancybox-outer,
Expand Down Expand Up @@ -154,9 +154,12 @@

.fancybox-tmp {
position: absolute;
top: -9999px;
left: -9999px;
top: -99999px;
left: -99999px;
visibility: hidden;
max-width: 99999px;
max-height: 99999px;
overflow: visible !important;
}

/* Overlay helper */
Expand Down
99 changes: 56 additions & 43 deletions source/jquery.fancybox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* fancyBox - jQuery Plugin
* version: 2.1.2 (Mon, 15 Oct 2012)
* version: 2.1.3 (Tue, 23 Oct 2012)
* @requires jQuery v1.6 or later
*
* Examples at http://fancyapps.com/fancybox/
Expand Down Expand Up @@ -48,7 +48,7 @@

$.extend(F, {
// The current version of fancyBox
version: '2.1.2',
version: '2.1.3',

defaults: {
padding : 15,
Expand Down Expand Up @@ -376,20 +376,20 @@
F.imgPreload.onload = F.imgPreload.onerror = null;
}

// If the first item has been canceled, then clear everything
if (coming.wrap) {
coming.wrap.stop(true).trigger('onReset').remove();
coming.wrap.stop(true, true).trigger('onReset').remove();
}

F.coming = null;

// If the first item has been canceled, then clear everything
if (!F.current) {
F.trigger('afterClose');
F._afterZoomOut( coming );
}

F.coming = null;
},

// Start closing animation if is open; remove immediately if opening/closing
close: function (immediately) {
close: function (event) {
F.cancel();

if (false === F.trigger('beforeClose')) {
Expand All @@ -398,7 +398,11 @@

F.unbindEvents();

if (!F.isOpen || immediately === true) {
if (!F.isActive) {
return;
}

if (!F.isOpen || event === true) {
$('.fancybox-wrap').stop(true).trigger('onReset').remove();

F._afterZoomOut();
Expand Down Expand Up @@ -561,7 +565,7 @@

F.wrap.removeClass('fancybox-tmp');

if (type !== 'scroll') {
if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
F._setDimension();
}

Expand Down Expand Up @@ -608,6 +612,8 @@
// If user will press the escape-button, the request will be canceled
D.bind('keydown.loading', function(e) {
if ((e.which || e.keyCode) === 27) {
e.preventDefault();

F.cancel();
}
});
Expand Down Expand Up @@ -744,10 +750,6 @@
return false;
}

if (event === 'onCancel' && !F.isOpened) {
F.isActive = false;
}

if (obj.helpers) {
$.each(obj.helpers, function (helper, opts) {
if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
Expand Down Expand Up @@ -1081,7 +1083,7 @@
scrolling = coming.scrolling;

$.extend(F, {
wrap : current.wrap.removeClass('fancybox-tmp'),
wrap : current.wrap,
skin : current.skin,
outer : current.outer,
inner : current.inner,
Expand Down Expand Up @@ -1199,7 +1201,7 @@
body;

// Reset dimensions so we could re-check actual size
wrap.add(skin).add(inner).width('auto').height('auto');
wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');

wPadding = getScalar(skin.outerWidth(true) - skin.width());
hPadding = getScalar(skin.outerHeight(true) - skin.height());
Expand Down Expand Up @@ -1425,20 +1427,26 @@

F.wrap.css('overflow', 'visible').addClass('fancybox-opened');

F.reposition();
F.update();

// Assign a click event
if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
e.preventDefault();

F[ current.closeClick ? 'close' : 'next' ]();
}
});
}

// Create a close button
if (current.closeBtn) {
$(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', F.close);
$(current.tpl.closeBtn).appendTo(F.skin).bind( isTouch ? 'touchstart.fb' : 'click.fb', function(e) {
e.preventDefault();

F.close();
});
}

// Create navigation arrows
Expand All @@ -1465,10 +1473,10 @@
}
},

_afterZoomOut: function () {
var current = F.current;
_afterZoomOut: function ( obj ) {
obj = obj || F.current;

$('.fancybox-wrap').stop(true).trigger('onReset').remove();
$('.fancybox-wrap').trigger('onReset').remove();

$.extend(F, {
group : {},
Expand All @@ -1485,7 +1493,7 @@
inner : null
});

F.trigger('afterClose', current);
F.trigger('afterClose', obj);
}
});

Expand Down Expand Up @@ -1687,22 +1695,25 @@
speedOut : 200, // duration of fadeOut animation
showEarly : true, // indicates if should be opened immediately or wait until the content is ready
css : {}, // custom CSS properties
locked : true // if true, the content will be locked into overlay
locked : !isTouch, // if true, the content will be locked into overlay
fixed : true // if false, the overlay CSS position property will not be set to "fixed"
},

overlay : null,
fixed : false,
overlay : null, // current handle
fixed : false, // indicates if the overlay has position "fixed"

// Public methods
create : function() {
create : function(opts) {
opts = $.extend({}, this.defaults, opts);

if (this.overlay) {
this.close();
}

this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( this.el || 'body' );
this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( 'body' );
this.fixed = false;

if (F.defaults.fixed && !isTouch) {
if (opts.fixed && F.defaults.fixed) {
this.overlay.addClass('fancybox-overlay-fixed');

this.fixed = true;
Expand All @@ -1718,7 +1729,7 @@
this.overlay.unbind('.overlay').width('auto').height('auto');

} else {
this.create();
this.create(opts);
}

if (!this.fixed) {
Expand Down Expand Up @@ -1748,6 +1759,16 @@
W.unbind('resize.overlay');

this.overlay = null;

if (this.margin !== false) {
$('body').css('margin-right', this.margin);

this.margin = false;
}

if (this.el) {
this.el.removeClass('fancybox-lock');
}
},

// Private, callbacks
Expand Down Expand Up @@ -1781,7 +1802,7 @@
this.margin = D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false;
this.el = document.all && !document.querySelector ? $('html') : $('body');

this.create();
this.create(opts);
}

if (opts.locked && this.fixed) {
Expand Down Expand Up @@ -1813,21 +1834,10 @@
},

afterClose: function (opts) {
var that = this,
speed = opts.speedOut;

// Remove overlay if exists and fancyBox is not opening
// (e.g., it is not being open using afterClose callback)
if (that.overlay && !F.isActive) {
that.overlay.fadeOut(speed || 0, function () {
if (that.margin !== false) {
$('body').css('margin-right', that.margin);
}

that.el.removeClass('fancybox-lock');

that.close();
});
if (this.overlay && !F.isActive) {
this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
}
}
};
Expand Down Expand Up @@ -1929,10 +1939,13 @@

if (!selector || options.live === false) {
that.unbind('click.fb-start').bind('click.fb-start', run);

} else {
D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
}

this.filter('[data-fancybox-start=1]').trigger('click');

return this;
};

Expand Down
Loading

0 comments on commit cd2bc9a

Please sign in to comment.