@fancyapps/fancybox
Advanced tools
Comparing version 3.4.2 to 3.5.0
{ | ||
"name": "@fancyapps/fancybox", | ||
"description": "Touch enabled, responsive and fully customizable jQuery lightbox script", | ||
"version": "3.4.2", | ||
"version": "3.5.0", | ||
"homepage": "https://fancyapps.com/fancybox/3/", | ||
@@ -6,0 +6,0 @@ "main": "dist/jquery.fancybox.js", |
@@ -74,3 +74,3 @@ // ========================================================================== | ||
if ( | ||
$el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio') || | ||
$el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') || | ||
$.isFunction($el.get(0).onclick) || | ||
@@ -136,3 +136,17 @@ $el.data("selectable") | ||
Guestures.prototype.destroy = function() { | ||
this.$container.off(".fb.touch"); | ||
var self = this; | ||
self.$container.off(".fb.touch"); | ||
$(document).off(".fb.touch"); | ||
if (self.requestId) { | ||
cancelAFrame(self.requestId); | ||
self.requestId = null; | ||
} | ||
if (self.tapped) { | ||
clearTimeout(self.tapped); | ||
self.tapped = null; | ||
} | ||
}; | ||
@@ -163,3 +177,2 @@ | ||
} | ||
// Ignore clicks on the scrollbar | ||
@@ -171,3 +184,3 @@ if (!$target.is("img") && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left) { | ||
// Ignore clicks while zooming or closing | ||
if (!current || instance.isAnimating || instance.isClosing) { | ||
if (!current || instance.isAnimating || current.$slide.hasClass("fancybox-animated")) { | ||
e.stopPropagation(); | ||
@@ -192,3 +205,3 @@ e.preventDefault(); | ||
self.canTap = !current.$slide.hasClass("fancybox-animated"); | ||
self.canTap = true; | ||
self.$target = $target; | ||
@@ -212,3 +225,3 @@ self.$content = $content; | ||
self.contentStartPos = $.fancybox.getTranslate(self.$content) || {top: 0, left: 0}; | ||
self.sliderStartPos = self.sliderLastPos || $.fancybox.getTranslate($slide); | ||
self.sliderStartPos = $.fancybox.getTranslate($slide); | ||
@@ -239,3 +252,5 @@ // Since position will be absolute, but we need to make it relative to the stage | ||
return; | ||
if (!($.fancybox.isMobile && $target.hasClass("fancybox-caption"))) { | ||
return; | ||
} | ||
} | ||
@@ -375,3 +390,7 @@ | ||
slide.$slide | ||
.removeAttr("style") | ||
.css({ | ||
transform: "", | ||
opacity: "", | ||
"transition-duration": "" | ||
}) | ||
.removeClass("fancybox-animated") | ||
@@ -383,2 +402,3 @@ .removeClass(function(index, className) { | ||
if (slide.pos === instance.current.pos) { | ||
self.sliderStartPos.top = slidePos.top - stagePos.top; | ||
self.sliderStartPos.left = slidePos.left - stagePos.left; | ||
@@ -462,4 +482,2 @@ } | ||
cancelAFrame(self.requestId); | ||
self.requestId = null; | ||
} | ||
@@ -613,4 +631,2 @@ | ||
cancelAFrame(self.requestId); | ||
self.requestId = null; | ||
} | ||
@@ -678,6 +694,5 @@ | ||
len = self.instance.group.length, | ||
velocityX = Math.abs(self.velocityX), | ||
distanceX = Math.abs(self.distanceX), | ||
canAdvance = swiping == "x" && len > 1 && ((self.dMs > 130 && distanceX > 10) || distanceX > 50), | ||
speedX = Math.abs((velocityX * self.canvasWidth) / self.canvasWidth) > 0.8 ? 366 : 500; | ||
speedX = 300; | ||
@@ -697,4 +712,3 @@ self.sliderLastPos = null; | ||
); | ||
ret = self.instance.close(true, 200); | ||
ret = self.instance.close(true, 250); | ||
} else if (canAdvance && self.distanceX > 0) { | ||
@@ -707,3 +721,3 @@ ret = self.instance.previous(speedX); | ||
if (ret === false && (swiping == "x" || swiping == "y")) { | ||
self.instance.centerSlide(self.instance.current, 150); | ||
self.instance.centerSlide(200); | ||
} | ||
@@ -779,5 +793,2 @@ | ||
// Switch from scale() to width/height or animation will not work correctly | ||
$.fancybox.setTranslate(self.$content, $.fancybox.getTranslate(self.$content)); | ||
$.fancybox.animate(self.$content, newPos, 150); | ||
@@ -819,3 +830,3 @@ } | ||
case "toggleControls": | ||
instance.toggleControls(true); | ||
instance.toggleControls(); | ||
@@ -903,3 +914,5 @@ break; | ||
process("click" + where); | ||
if (!instance.isAnimating) { | ||
process("click" + where); | ||
} | ||
}, 500); | ||
@@ -914,7 +927,13 @@ } else { | ||
$(document).on("onActivate.fb", function(e, instance) { | ||
if (instance && !instance.Guestures) { | ||
instance.Guestures = new Guestures(instance); | ||
} | ||
}); | ||
$(document) | ||
.on("onActivate.fb", function(e, instance) { | ||
if (instance && !instance.Guestures) { | ||
instance.Guestures = new Guestures(instance); | ||
} | ||
}) | ||
.on("beforeClose.fb", function(e, instance) { | ||
if (instance && instance.Guestures) { | ||
instance.Guestures.destroy(); | ||
} | ||
}); | ||
})(window, document, jQuery); |
@@ -46,24 +46,25 @@ // ========================================================================== | ||
var self = this, | ||
first, | ||
second; | ||
group = instance.group, | ||
enabled = 0; | ||
self.instance = instance; | ||
self.opts = group[instance.currIndex].opts.thumbs; | ||
instance.Thumbs = self; | ||
self.opts = instance.group[instance.currIndex].opts.thumbs; | ||
self.$button = instance.$refs.toolbar.find("[data-fancybox-thumbs]"); | ||
// Enable thumbs if at least two group items have thumbnails | ||
first = instance.group[0]; | ||
first = first.opts.thumb || (first.opts.$thumb && first.opts.$thumb.length ? first.opts.$thumb.attr("src") : false); | ||
for (var i = 0, len = group.length; i < len; i++) { | ||
if (group[i].thumb) { | ||
enabled++; | ||
} | ||
if (instance.group.length > 1) { | ||
second = instance.group[1]; | ||
second = second.opts.thumb || (second.opts.$thumb && second.opts.$thumb.length ? second.opts.$thumb.attr("src") : false); | ||
if (enabled > 1) { | ||
break; | ||
} | ||
} | ||
self.$button = instance.$refs.toolbar.find("[data-fancybox-thumbs]"); | ||
if (self.opts && first && second) { | ||
self.$button.show().on("click", function() { | ||
if (enabled > 1 && !!self.opts) { | ||
self.$button.removeAttr("style").on("click", function() { | ||
self.toggle(); | ||
@@ -106,3 +107,3 @@ }); | ||
$.each(instance.group, function(i, item) { | ||
src = item.opts.thumb || (item.opts.$thumb ? item.opts.$thumb.attr("src") : null); | ||
src = item.thumb; | ||
@@ -117,3 +118,3 @@ if (!src && item.type === "image") { | ||
'"' + | ||
(src && src.length ? ' style="background-image:url(' + src + ')"' : "") + | ||
(src && src.length ? ' style="background-image:url(' + src + ')"' : 'class="fancybox-thumbs-missing"') + | ||
"></a>" | ||
@@ -120,0 +121,0 @@ ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
521308
10595