sdecima / javascript-detect-element-resize

A Cross-Browser, Event-based, Element Resize Detection
MIT License
879 stars 150 forks source link

Added bower.json #5

Closed motorcityadam closed 9 years ago

motorcityadam commented 10 years ago

Added a bower.json to allow me to use grunt-bower-task to include this project as a dependency on one of my projects. I had to increase the version to 0.5.2 to repackage the release for Bower. This Closes #3.

oste commented 10 years ago

+1 for a merge

djmccormick commented 10 years ago

+1

sdecima commented 10 years ago

Thanks for the contribution, I'm reviewing all the changes now.

mtraynham commented 9 years ago

+1 on the display:none detection, I thought it was related to that, but glad to see someone else has confirmed.

Might I suggest a different solution, a trick I learned from jQuery and element dimensions. When you ask for the offsetWidth on an element and it is display:none, you'll get 0. When you ask jQuery for the $('#...').width() on a display:none object, it temp sets the display to block, grabs the width and sets it back to none. This would all happen between the redraw interval, so the user won't even notice.

Maybe you could do something similar instead of polling.

sdecima commented 9 years ago

I finally merged most of the changes proposed in this pull request, and changed the polling with a CSS animation to detect when the element is visible as discussed with @thomassuckow.