abouolia / sticky-sidebar

😎 Pure JavaScript tool for making smart and high performance sticky sidebar.

Home Page:https://abouolia.github.io/sticky-sidebar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

recalculate if container dom changed.

yaquawa opened this issue · comments

commented

I think to use ResizeSensor.js is a bit overkill, why not just add a few lines to use MutationObserver instead ? (if the browser supports)

ResizeSensor.js does use the Mutation Observer API, the problem is that mutations are a bad fit for resize events.

Instead I think you'll want to use a Resize Observer - but there's no support for IE and limited Firefox support.

commented

Hi @SlimerDude , I mean if ResizeSensor.js is not detected, fallback to use MutationObserver or as you said the Resize Observer if browser supports. Chances are many people like me don't support IE, so no need to use ResizeSensor.js at all, it increase the bundle size a lot.

Currently I can use Mutation Observer to call the update method of sticky-sidebar when the content of the sidebar changed, but I would like see this tiny logic could be sit in the core in the first place.

I use this library in many of my projects, I really appreciate your great work, and hope this little change can be added to the core. Thanks.