return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
-}
\ No newline at end of file
+}
+
+function loadImage(src, callback) {
+ var img = new Image();
+ var loaded = false;
+ $(img).on('load', function () {
+ if (loaded) {
+ return;
+ }
+ loaded = true;
+ callback(img);
+ });
+ img.src=src;
+ if ($(img).isLoaded()) {
+ if (!loaded) {
+ loaded = true;
+ callback(img);
+ }
+ }
+ return img;
+}
+
},
zoomLink: function (link) {
-
var $this = this;
- // Todo : should be impossible thanks to the overlay
- if ($('body').hasClass('zoomPopup')) return false; // Ignore clicks on other zoom links if popup is already open
-
// If the interface is zoomed in, we must zoom out first
if (this.fluidbook.zoom.zoom > 1) {
console.log('zooming out before opening zoom box');
//currentScale = this.fluidbook.desktop.desktopScale; // Get current scale so the size of the popup can be calculated correctly
// Wait for clickZoom out to finish before trying again to open zoom link
- $(document).one('fluidbook.zoom.out.end', function () {
+ $(this.fluidbook).one('fluidbook.zoom.out.end', function () {
$this.zoomLink(link);
});
width: box.width,
height: box.height,
left: box.left,
- top: box.top,
- backgroundImage: 'url(' + zoomImage + ')'
+ top: box.top
});
+ z.find('img').remove();
- z.show();
-
- setTimeout(function () {
- z.css({
- transform: 'translateX(' + x + 'px) translateY(' + y + 'px)',
- width: zoomWidth,
- height: zoomHeight
- });
- }, 50);
+ this.fluidbook.displayLoader();
+ loadImage(zoomImage, function (img) {
+ z.append(img);
+ this.fluidbook.hideLoader();
+ z.show();
- z.data('scale', zoomScale);
-
- // Todo : still useful ?
- $('body').addClass('zoomPopup');
+ setTimeout(function () {
+ z.css({
+ transform: 'translateX(' + x + 'px) translateY(' + y + 'px)',
+ width: zoomWidth,
+ height: zoomHeight
+ });
+ }, 50);
+ z.data('scale', zoomScale);
+ // Show overlay
+ $('body').addClass('zoomPopup');
+ });
},
zoomLinkReset: function () {
var replaceby = "/" + id + "/";
url = url.replace(replace, replaceby);
return url;
-}
\ No newline at end of file
+}
+
+$(function () {
+ $.fn.isLoaded = function () {
+ var img = $(this).get(0);
+ if (img.readyState === 4 || img.readyState === 'complete') {
+ return true;
+ }
+ if (img.complete) {
+ return true;
+ }
+ return false;
+ }
+})
white-space: nowrap;
text-decoration: underline;
}
-/* Zoom on double tap */
-#zoomguides {
- width: 100%;
- height: 100%;
- position: relative;
- z-index: 100;
- top: 0;
- left: 0;
- overflow: hidden;
-}
-#zoomguides p {
- color: #fff;
- font-size: 12px;
- width: 24%;
- display: inline-block;
- max-height: 100%;
- overflow: hidden;
-}
/* Zoom Image Popups */
#zoomPopupOverlay {
position: absolute;
left: 0;
width: 100%;
height: 100%;
- background-color: rgba(0, 0, 0, 0.6);
+ background-color: rgba(0, 0, 0, 0);
z-index: 100;
display: none;
}
}
#zoomPopupWrapper {
display: none;
- background-color: #ccc;
+ background-color: transparent;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
position: absolute;
z-index: 101;
}
+#zoomPopupWrapper img {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ display: block;
+}
.zoomPopupClose {
position: absolute;
top: 10px;
}
-/* Zoom on double tap */
-
-#zoomguides {
- width: 100%;
- height: 100%;
- position: relative;
- z-index: 100;
- top: 0;
- left: 0;
- overflow: hidden;
-
- p {
- color: #fff;
- font-size: 12px;
- width: 24%;
- display: inline-block;
- max-height: 100%;
- overflow: hidden;
- }
-}
-
/* Zoom Image Popups */
#zoomPopupOverlay {
position: absolute;
left: 0;
width: 100%;
height: 100%;
- background-color: rgba(0,0,0,0.6);
+ background-color: rgba(0, 0, 0, 0);
z-index: 100;
display: none;
#zoomPopupWrapper {
display: none;
- background-color: #ccc;
+ background-color: transparent;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
transform-origin: 0 0;
position: absolute;
z-index: 101;
+
+ img {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ display: block;
+ }
}
.zoomPopupClose {