So I’ve been scribbling this demo together that’s tested back and forth in an effort to account for all circumstances. Seems to work nicely on Codepen but when embedded, the margins applied with js don’t seem to work. Clicking on ‘align’ will ignore the new values :
http://codepen.io/Shikkediel/pen/dPOVJp?editors=011
Anybody have an idea what is causing this? Not a clue myself…
Edit – it must have something to do with passing the margins as an array but that should be (and is normally) fine with jQuery 1.9+.