marcj / css-element-queries

CSS Element-Queries aka Container Queries. High-speed element dimension/media queries in valid css.
http://marcj.github.io/css-element-queries/
MIT License
4.27k stars 487 forks source link

fix: sensor not working when element's width or height is 0 #203

Closed lxjwlt closed 6 years ago

lxjwlt commented 6 years ago

when element's width or height is 0, resizeSensor get 0 as well, so it cannot trigger scroll event properly.

set top and left to -10px, make sure the width and height of resizeSensor has 10px at least.

bug example: https://jsfiddle.net/lxjwlt/ko7ha6va/ after fixing: https://jsfiddle.net/lxjwlt/3hhownrp/

marcj commented 6 years ago

Good fix, thanks!