jakiestfu / Snap.js

A Library for creating beautiful mobile shelfs in Javascript (Facebook and Path style side menus)
http://jakiestfu.github.io/Snap.js/
5.99k stars 663 forks source link

Body classes do not account for nested shelves #230

Open jtrussell opened 10 years ago

jtrussell commented 10 years ago

This might be outside the intended scope of the library but I thought I'd point out that the code which adds and removes snapjs-* classes to the body assumes there is only one snapper object operating on the page. This creates issues when I have multiple snappers and the state of the last one to be toggled doesn't reflect the state of the page as a whole.

Here's a demo to illustrate: http://jsbin.com/pakud/8

Of course this gets even messier if the snappers aren't open to the same side... not sure why anyone would want to do that but there you have it. I don't have a great solution to propose other than perhaps just assigning the snapjs-* classes to the element tied to the snapper object.