Closed Athar42 closed 6 months ago
The problem seems to be due to the additional <div class="lg-img-rotate">
element introduced by the lgRotate plugin. This element overlaps the
Proposed fix is to modify the condition that determines whether a click should close the image. By adding target.hasClass('lg-img-rotate') to the condition, it ensures that clicks on the lg-img-rotate element are treated the same as clicks on the other specified elements (lg-outer, lg-item, lg-img-wrap), thus restoring the close-on-click functionality even when the lgRotate plugin is active.
Here's a clearer explanation of the proposed fix:
isSlideElement(target: lgQuery): boolean {
return (
target.hasClass('lg-outer') ||
target.hasClass('lg-item') ||
target.hasClass('lg-img-wrap') ||
target.hasClass('lg-img-rotate') // Added line: also close if clicked on the rotate element.
);
}
This modification adds a check for the lg-img-rotate class. If the clicked element has this class, it will trigger the image to close, which aligns with the behavior observed when the lgRotate plugin is not active.
I can confirm that the proposed fix by @bytesandbots3 is working, tested on my end and it seems all good now, thanks :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Description
When an image in zoomed in, we should be able to close the view by clicking in the black area. This is working until we enable the "lgRotate" plugin.
Steps to reproduce
This behavior can be seen here : https://www.lightgalleryjs.com/demos/thumbnails/
Click, for example, on the first image, then click on either of the border (left or right) ==> The image will not be closed.
Now, if you do "one rotation" (either side) then you attempt to click on either border ==> The image will close.
If lgRotate plugin is removed, we can get the normal behavior back :)
For this same example, the issue seems to be that the added div :
did overlap the picture statement :
Environment
Additional context