Skip to content

Commit

Permalink
Op-207 fix fancybox zoom (#711)
Browse files Browse the repository at this point in the history
* Revert "Remove afterShow callback for mod_collection fancybox (#707)"

This reverts commit e64a9f2.

* Properly fix fancybox compatibility issue

And rename file so it seems less specific to Hart

Co-authored-by: Colin de Roos <colin@driebit.nl>
  • Loading branch information
cdfa and Colin de Roos authored Sep 2, 2022
1 parent 2081e38 commit 5a54c1e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
32 changes: 32 additions & 0 deletions modules/mod_ginger_collection/lib/css/src/blocks/_fancybox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,35 @@
from { opacity: 1; }
to { opacity: 0; }
}

.zoom-help {
display: flex;
align-items: center;
justify-content: center;
width: 70px;
height: 70px;
position: absolute;
top: 50%;
left: 50%;
z-index: 100;
background: rgba($black,0.5);
transform: translate(-50%, -50%);
color: $white;
animation: fadeOut 2s 1;
animation-fill-mode: forwards;
animation-delay: 1s;
pointer-events: none;

&:before {
@extend .has-icon;
@extend .icon--search:before;
font-size: 30px;
}

&:after {
content: '+';
height: 10px;
position: absolute;
top: 18px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ $(document).ready(function () {
'scrolling': false,
"padding": 0,
'type': 'image',
'clickContent': false,
'tpl': {
error: '<p class="fancybox-error"></p>'
},
Expand All @@ -36,6 +37,16 @@ $(document).ready(function () {
beforeLoad: function () {
/* You can use callbacks to customize or disable title */
this.title = false;
},
afterShow: function () {
$('.fancybox-inner').prepend('<div class="zoom-help"></div>');

$('.fancybox-image')
.parent()
.zoom({
magnify: 1.25,
on: 'click'
});
}
});
});
2 changes: 1 addition & 1 deletion modules/mod_ginger_collection/templates/_script.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% lib
"js/jquery.zoom.min.js"
"js/back-to-top.js"
"js/beeldenzoeker.js"
"js/images-collection.js"
"js/loadmore.js"
"js/search/components/filters-edge.js"
"js/search/components/filters-license.js"
Expand Down

0 comments on commit 5a54c1e

Please sign in to comment.