Skip to content

Commit

Permalink
Merge pull request #5 from Abrakso/patch-1
Browse files Browse the repository at this point in the history
disable form overflow on zoom image
  • Loading branch information
agoalofalife authored Aug 28, 2023
2 parents f12f27d + 12fb811 commit b1539e1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions resources/js/controllers/image_zoom_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,29 @@ import Zooming from 'zooming'
export default class extends window.Controller {
connect() {
const zooming = new Zooming({
onBeforeOpen: function () {
onBeforeOpen: function() {
var table = document.querySelector('.table-responsive');
var form = document.querySelector('#post-form');
var itHasHappenedInTable = table !== null;
var itHasHappenedInPostForm = form !== null;
if (itHasHappenedInTable) {
document.querySelector('.table-responsive').style.overflowX = 'visible'
document.querySelector('.table-responsive').style.overflowX = 'visible';
}
if (itHasHappenedInPostForm) {
form.classList.remove('overflow-hidden');
}
},
onClose: function () {
onClose: function() {
var table = document.querySelector('.table-responsive');
var form = document.querySelector('#post-form');
var itHasHappenedInTable = table !== null;
var itHasHappenedInPostForm = form !== null;
if (itHasHappenedInTable) {
document.querySelector('.table-responsive').style.overflowX = 'auto'
document.querySelector('.table-responsive').style.overflowX = 'auto';
}
if (itHasHappenedInPostForm) {
form.classList.add('overflow-hidden');
}

},
customSize: this.data.get('zoompercent') || 100 + '%'
})
Expand Down

0 comments on commit b1539e1

Please sign in to comment.