Fat Monk
Fat Monk

Reputation: 2265

Javascript to slide a div off the left of the screen

I know there are various solutions out there, including JQuery solutions, that will do this, but I was trying to write my own simple version...

I want to hide a <div> but sliding it off the left or right of the screen.

For some reason I'm unable to read and set the .style.left value of my div though.

This fiddle shows the problem: http://jsfiddle.net/47MNX/3/

Upvotes: 0

Views: 75

Answers (1)

j08691
j08691

Reputation: 207963

Seems to work fine if you set the position property, e.g. position:absolute; (or relative) to #myLeftMenu. You never set the position, so while the JavaScript was running it had no way to make the change.

jsFiddle example

Upvotes: 4

Related Questions