Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
Updated to v3.5.2
Browse files Browse the repository at this point in the history
- Fixed #2122 - Focusable HTML5 video
- Fixed #2128 - Missing smallBtn on mobile
- Fixed #2096 - autoStart fullscreen AND slideshow
- Fixed #2097 - German translation
- Fixed #2132 - Youtube fullscreen

- Captions now have linear-gradient background (instead of background image for pseudo element) and can have max-height and vertical scrollbar
- Improved design for phones having the notch (https://webkit.org/blog/7929/designing-websites-for-iphone-x/)
  • Loading branch information
fancyapps committed Dec 10, 2018
1 parent 920b3e4 commit 5f7dd47
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 102 deletions.
32 changes: 16 additions & 16 deletions dist/jquery.fancybox.css
Original file line number Diff line number Diff line change
Expand Up @@ -400,38 +400,32 @@ body.compensate-for-scrollbar {

.fancybox-navigation .fancybox-button--arrow_left {
left: 0;
left: env(safe-area-inset-left);
padding: 31px 26px 31px 6px; }

.fancybox-navigation .fancybox-button--arrow_right {
padding: 31px 6px 31px 26px;
right: 0; }
right: 0;
right: env(safe-area-inset-right); }

/* Caption */
.fancybox-caption {
background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.15) 65%, rgba(0, 0, 0, 0.075) 75.5%, rgba(0, 0, 0, 0.037) 82.85%, rgba(0, 0, 0, 0.019) 88%, transparent 100%);
bottom: 0;
color: #eee;
font-size: 14px;
font-weight: 400;
left: 0;
line-height: 1.5;
padding: 25px 44px 25px 44px;
overflow: auto;
padding: 50px 44px 25px 44px;
right: 0;
text-align: center;
z-index: 99996; }

.fancybox-caption::before {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAD6CAQAAADKSeXYAAAAYklEQVQoz42RwQ3AMAgDjfcfup8WoRykfBAK5mQHKSz5rbXJPis1hjiV3CIqgG0hLZPkVkA4p4x5oR1bVeDrdCLrW2Q0D5bcwY3TGMHbdw3mPRuOtaspYP1w//G1OIcW148H0DMCqI/3mMMAAAAASUVORK5CYII=);
background-repeat: repeat-x;
background-size: contain;
bottom: 0;
content: '';
display: block;
left: 0;
pointer-events: none;
position: absolute;
right: 0;
top: -44px;
z-index: -1; }
.fancybox-caption--separate {
margin-top: -25px;
max-height: 50vh; }

.fancybox-caption a,
.fancybox-caption a:link,
Expand Down Expand Up @@ -567,7 +561,8 @@ body.compensate-for-scrollbar {
/* Styling for Small-Screen Devices */
@media all and (max-height: 576px) {
.fancybox-caption {
padding: 12px; }
padding-left: 12px;
padding-right: 12px; }
.fancybox-slide {
padding-left: 6px;
padding-right: 6px; }
Expand All @@ -585,6 +580,11 @@ body.compensate-for-scrollbar {
top: 0;
width: 36px; } }

/* Using calc to trick sass */
@supports (padding: 0px) {
.fancybox-caption {
padding: 50px calc(max(12px, env(safe-area-inset-right))) calc(max(12px, env(safe-area-inset-bottom))) calc(max(25px, env(safe-area-inset-left))); } }

/* Share */
.fancybox-share {
background: #f4f4f4;
Expand Down
67 changes: 33 additions & 34 deletions dist/jquery.fancybox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==================================================
// fancyBox v3.5.2
// fancyBox v3.5.3
//
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
Expand Down Expand Up @@ -111,7 +111,7 @@
iframe: {
// Iframe template
tpl:
'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen allow="autoplay; fullscreen" src=""></iframe>',
'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""></iframe>',

// Preload iframe before displaying it
// This allows to calculate iframe content width and height
Expand Down Expand Up @@ -394,17 +394,17 @@
ZOOM: "Zoom"
},
de: {
CLOSE: "Schliessen",
CLOSE: "Schlie&szlig;en",
NEXT: "Weiter",
PREV: "Zurück",
ERROR: "Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es später nochmal.",
PREV: "Zur&uuml;ck",
ERROR: "Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es sp&auml;ter nochmal.",
PLAY_START: "Diaschau starten",
PLAY_STOP: "Diaschau beenden",
FULL_SCREEN: "Vollbild",
THUMBS: "Vorschaubilder",
DOWNLOAD: "Herunterladen",
SHARE: "Teilen",
ZOOM: "Maßstab"
ZOOM: "Vergr&ouml;&szlig;ern"
}
}
};
Expand Down Expand Up @@ -645,13 +645,7 @@
var arr = obj.opts.i18n[obj.opts.lang] || obj.opts.i18n.en;

return str.replace(/\{\{(\w+)\}\}/g, function(match, n) {
var value = arr[n];

if (value === undefined) {
return match;
}

return value;
return arr[n] === undefined ? match : arr[n];
});
},

Expand Down Expand Up @@ -922,11 +916,14 @@
self.$refs.stage.hide();
}

setTimeout(function() {
self.$refs.stage.show();
setTimeout(
function() {
self.$refs.stage.show();

self.update(e);
}, $.fancybox.isMobile ? 600 : 250);
self.update(e);
},
$.fancybox.isMobile ? 600 : 250
);
}
});

Expand All @@ -949,7 +946,7 @@
// Enable keyboard navigation
// ==========================

if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input") || $(e.target).is("textarea")) {
if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input,textarea,video,audio")) {
return;
}

Expand Down Expand Up @@ -1325,7 +1322,7 @@
scaleX: scaleX,
scaleY: scaleY
},
duration || 330,
duration || 366,
function() {
self.isAnimating = false;
}
Expand Down Expand Up @@ -1366,7 +1363,7 @@
scaleX: end.width / $content.width(),
scaleY: end.height / $content.height()
},
duration || 330,
duration || 366,
function() {
self.isAnimating = false;
}
Expand Down Expand Up @@ -1986,11 +1983,6 @@
$slide = slide.$slide,
$iframe;

// Fix responsive iframes on iOS (along with `position:absolute;` for iframe element)
if ($.fancybox.isMobile) {
opts.css.overflow = "scroll";
}

slide.$content = $('<div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden" : "") + '"></div>')
.css(opts.css)
.appendTo($slide);
Expand Down Expand Up @@ -2034,7 +2026,7 @@
$body = $contents.find("body");
} catch (ignore) {}

// Calculate contnet dimensions if it is accessible
// Calculate content dimensions, if it is accessible
if ($body && $body.length && $body.children().length) {
// Avoid scrolling to top (if multiple instances)
$slide.css("overflow", "visible");
Expand Down Expand Up @@ -2312,9 +2304,12 @@
current = slide || self.current,
caption = current.opts.caption,
$caption = self.$refs.caption,
captionH = false;
captionH = false,
preventOverlap = current.opts.preventCaptionOverlap;

$caption.toggleClass("fancybox-caption--separate", preventOverlap);

if (current.opts.preventCaptionOverlap && caption && caption.length) {
if (preventOverlap && caption && caption.length) {
if (current.pos !== self.currPos) {
$caption = $caption
.clone()
Expand Down Expand Up @@ -2649,6 +2644,8 @@
"iframe",
"object",
"embed",
"video",
"audio",
"[contenteditable]",
'[tabindex]:not([tabindex^="-"])'
].join(","),
Expand Down Expand Up @@ -3041,7 +3038,7 @@
});

$.fancybox = {
version: "3.5.2",
version: "3.5.3",
defaults: defaults,

// Get current instance and execute a command.
Expand Down Expand Up @@ -3445,8 +3442,8 @@
},
paramPlace: 8,
type: "iframe",
url: "//www.youtube-nocookie.com/embed/$4",
thumb: "//img.youtube.com/vi/$4/hqdefault.jpg"
url: "https://www.youtube-nocookie.com/embed/$4",
thumb: "https://img.youtube.com/vi/$4/hqdefault.jpg"
},

vimeo: {
Expand Down Expand Up @@ -4450,7 +4447,7 @@
newPos.width = self.contentStartPos.width;
newPos.height = self.contentStartPos.height;

$.fancybox.animate(self.$content, newPos, 330);
$.fancybox.animate(self.$content, newPos, 366);
};

Guestures.prototype.endZooming = function() {
Expand Down Expand Up @@ -4944,11 +4941,13 @@
if (instance) {
// If image is zooming, then force to stop and reposition properly
if (instance.current && instance.current.type === "image" && instance.isAnimating) {
instance.current.$content.css("transition", "none");

instance.isAnimating = false;

instance.update(true, true, 0);

if (!instance.isComplete) {
instance.complete();
}
}

instance.trigger("onFullscreenChange", isFullscreen);
Expand Down
Loading

16 comments on commit 5f7dd47

@Eldenroot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v3.5.3 :)

Thank you for the update! I am still looking for v3.6 (or whatever version) with these thow addtions:

Keep good work!

@acwolff
Copy link

@acwolff acwolff commented on 5f7dd47 Dec 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!
But I think the text on page https://github.com/fancyapps/fancybox should be changed into "updated to version 3,5.3"

@fancyapps
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acwolff Yes, I noticed that but, unfortunately, it is a big pain to change something in git without breaking something up (see https://help.github.com/articles/changing-a-commit-message/), so, that typo will stay to remind to be more careful in the future :)

@Eldenroot Sorry, I have been working on v4 for some time and will resume the work; current branch will receive small patches only.

@Eldenroot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fancyapps - no need to say sorry my friend, I am looking forward to see v4 sooner or later :)

@acwolff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please give more details about the new “mproved design for phones having the notch” , because I see no differente with the previous version.

@fancyapps
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acwolff Did you check the link in the description - https://webkit.org/blog/7929/designing-websites-for-iphone-x/ ? I think it should be pretty clear after reading that.

Basically, CSS now contains these new CSS environment variables (like safe-area-inset-left, etc) and functions (env() and max()). Note that in order for your page to look good on phones like iPhone X/XS, you also need to add:

<meta name='viewport' content='initial-scale=1, viewport-fit=cover'>

@acwolff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in my case this is not correctly working on a iPhoneXR, see this test, On an iPhone XR I see with version 3.5.3:
iphonexr_fb_3 5 3
and with an iPhone5:
iphone5_fb_3 5 3
But with version 3,5.2 I see on an iPhone XR:
iphonexr_fb_3 5 2
To solve this problem, I have to remove from the css file:
/* Using calc to trick sass */
@supports (padding: 0px) {
.fancybox-caption {
padding: 50px calc(max(12px, env(safe-area-inset-right))) calc(max(12px, env(safe-area-inset-bottom))) calc(max(25px, env(safe-area-inset-left))); } }

@fancyapps
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing the correct viewport meta tag.

@acwolff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I have this:
meta

@fancyapps
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is what I see (from your link):

<meta name='generator' content='jAlbum 17.1.1 with FancyBox version 1.3.4, created: 2018-12-11'>
<meta name='keywords' content='Fishermen&acute;s Trail, Rota Vicentina, Alentejo, Portugal, GPS, wandelen, hiking'>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta property="og:url" content="https://AndreWolff.jalbum.net/Rota_Vicentina_FB/508/index.htm">
<meta property="og:image" content="https://AndreWolff.jalbum.net/Rota_Vicentina_FB/508/folderimage.jpg">
<meta property="og:title" content="Fishermen&acute;s Trail">

@acwolff
Copy link

@acwolff acwolff commented on 5f7dd47 Dec 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry my fault, but it gets even worse after I corrected it: I can't removed the iPhone address bar and the caption is no longer visible:
iphonexr_fb_3 5 3-2
I used before the side panel to remove the iPhone addres bar.
To see thge caption I have to rotate the iPhone:
iphonexr_fb_3 5 3-2v

Edit:

I had hidden the scroll bars, if I disable that it becomes better:
iphonexr_fb_3 5 3-3

But the bacground area of the caption is incorrect and it is difficult to reproduce this view, most times i get the address bar in view.

To get the background correct, I have to remove the /* Using calc to trick sass */ code.

@fancyapps
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that is how iOS works and has been "working" for years. Other than that - it works fine.

@acwolff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I had no problems at all with version 3.5.2, so I will make this viewport-fit=cover an option or disable it.

@acwolff
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works correctly for my jAlbum FancyBox skin if I change your sass code into:

/* Using calc to trick sass, changed by AW  to avoid doubling iPhone XR caption background height */
@supports (padding: 0px) {
  .fancybox-caption {
    padding-right: 50px calc(max(12px, env(safe-area-inset-right))) calc(max(12px, env(safe-area-inset-bottom))) calc(max(25px, env(safe-area-inset-left))); 
    padding-left:  50px calc(max(12px, env(safe-area-inset-right))) calc(max(12px, env(safe-area-inset-bottom))) calc(max(25px, env(safe-area-inset-left)));
	} 
}

as you can see here. This displays on an iPhone XR as:

iphonexr_fb_ok

@fancyapps
Copy link
Owner Author

@fancyapps fancyapps commented on 5f7dd47 Dec 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, your CSS values are not valid. But I just noticed one thing - Gulp broke the code by changing this line -

@supports (padding: max(0px)) {
(https://github.com/fancyapps/fancybox/blob/master/src/css/core.css#L643)

into

@supports (padding: 0px) {

(https://github.com/fancyapps/fancybox/blob/master/dist/jquery.fancybox.css#L584)

And this is very important change. I'll try to figure out how to overcome this.

@acwolff
Copy link

@acwolff acwolff commented on 5f7dd47 Dec 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it might be invalid, but it did work correctly.
But I changed the code into:

/* Using calc to trick sass , changed by AW  to avoid doubling iPhone XR caption background height */
@supports (padding: max(0px)) {
  .fancybox-caption {
    padding-right: 50px calc(max(12px, env(safe-area-inset-right))) calc(max(12px, env(safe-area-inset-bottom))) calc(max(25px, env(safe-area-inset-left))); 
    padding-left:  50px calc(max(12px, env(safe-area-inset-right))) calc(max(12px, env(safe-area-inset-bottom))) calc(max(25px, env(safe-area-inset-left)));
	} 
}

Is this correct?

It works OK as you can see here.

Edit:

I added this:
.fancybox-caption {
padding: 12px;
}
to prevent that the caption is partly hidden by the horizontal line generated by iOS:

iphonexr_fb_padding12

Please sign in to comment.