-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Hi there,
Been using this in something for awhile now. Works pretty great.
However I've noticed sometimes for some reason the container has 1 pixel width and height more than the image and the image gets an offset of -0.5px for top and left which I think at some window sizes the browser will round it to move a full pixel and sometimes not which causes it to cut off the first pixel of the top and left of the image which is quite noticeable when that is a 1px border around the image.
I don't know if this is the best way to fix it or not but I found that adding Math.ceil to the layout.x and layout.y values fixed it for me. I'm wondering if maybe there is a better way somewhere else?
$element.css({position: 'absolute', top: Math.ceil(layout.y) + 'px', left: Math.ceil(layout.x) + 'px', width: layout.width + 'px', height: layout.height + 'px', 'max-width': 'none'});
Thanks!