links.forEach(function(zoomLink, index) {
// console.log(index, 'Found link with ID: ' + zoomLink.attr('id'));
- var zoomID = zoomLink.attr('id');
+ var zoomID = zoomLink.attr('id'),
+ $groupWrapper = $('#zoomPopupGroupWrapper');
// Add holder for each zoom zone
- $('#zoomPopupGroupWrapper').append('<div class="zoomPopupWrapper" id="zoomPopup_'+ zoomID +'"><a href="#" class="zoomPopupClose">' + getSpriteIcon('interface-close') + '</a></div>');
+ $groupWrapper.append('<div class="zoomPopupWrapper" id="zoomPopup_'+ zoomID +'"><a href="#" class="zoomPopupClose">' + getSpriteIcon('interface-close') + '</a></div>');
var z = $('#zoomPopup_' + zoomID),
box = zoomLink[0].getBoundingClientRect(), // Should return full values without rounding
// Position elements based on the layout
// There are two possible layouts: stacked or side-by-side
if (layout == 'stacked') {
+
+ $groupWrapper.addClass('layout-stacked');
+
// Calculate translate co-ordinates so image is centred correctly
// Values are rounded so we don't end up with image being positioned between pixels, which causes blurring
zoomX = Math.round((availableWidth / 2) - parent.offset().left - (zoomWidth / 2) + zoomMargin);
}
} else {
// Side-by-side layout
+ $groupWrapper.addClass('layout-side-by-side');
+
// Vertically centre each block
zoomY = Math.round((availableHeight / 2) - parent.offset().top - (zoomHeight / 2) + zoomMargin);
setTimeout(function () {
$('.zoomPopupWrapper').hide();
$wrapper.html(''); // Empty group wrapper
+ $wrapper.removeClass(); // Remove all classes (stacked / side-by-side layout)
}, 500);
return false;
.overlayBackground();
}
+// Depending on the layout, hide one of the close buttons
+// We need to define both first and last rules in case there is only one zoom zone
+// In this case, the last written rule will apply
+#zoomPopupGroupWrapper {
+ &.layout-stacked {
+ .zoomPopupWrapper:last-of-type .zoomPopupClose {
+ display: none;
+ }
+ .zoomPopupWrapper:first-of-type .zoomPopupClose {
+ display: block;
+ }
+ }
+ &.layout-side-by-side {
+ .zoomPopupWrapper:first-of-type .zoomPopupClose {
+ display: none;
+ }
+ .zoomPopupWrapper:last-of-type .zoomPopupClose {
+ display: block;
+ }
+ }
+}
+
.zoomPopupWrapper, .zoomPopupClose {
cursor: zoom-out !important; // Needed for close link, otherwise pointer cursor is used
}
display: none;
}
+/* General Utils */
+.pointer-events-none {
+ pointer-events: none;
+}
+
/* Webfonts*/
@font-face {