Closed mkabakovitch closed 1 year ago
I would like to avoid this solution, because some custom templates might use a background image on <a>
and not have <img>
at all.
Please try adding this CSS instead:
.gallery-item {display: inline-block;}
.gallery-item > img {display: block;}
This should make height of <a>
same as <img>
and calculations should work as expected (tested on your link with Dev Tools). If it's OK, I'll probably add a stylesheet to the plugin or update the README 🤔
The display
soluton also works, so I reverted to the original version of the plugin.
I think, it would make sense at least to mention it in the documentation, because without this modification and with the template provided the offset would not be calculated correctly.
If the selector selector item is
a
, then the Y-offset is incorrectly calculated. Instead of using thetop
property of the selector item, thetop
property of enclosedimg
item must be used. Actually, there is no need forcenterThumbPosition
option. So, instead of current implementation:Something like this could be used:
Tested here