Forum Moderators: open
Is there anyway i can save its last co-ordinates in a cookie?
Basically (or perhaps not so basically), i want to store the co-ordinates in a cookie, so that when the user cliks through to a new page, the draggable menu for that page loads in the same position as it was left on the previous page...............does this make sense?
Any ideas?
Webboy
On the next page, read these coordinates and use them to reposition the layer.
The best way would be for you to sit down and slog your way through it! That way you'll have a perfect understanding of what's happening and how to tailor changes to suit your needs!
The areas to look at would be:
You will find some nice snippets of code in the handy, generic javascript coding thread [webmasterworld.com], and there are plenty of online resources that will help you out - the best one being here!
>> Gets the X & Y offsets between the cursor and the layer coordinates.
>> Resets the x & Y coordinates of the layer as the cursor moves (layer.top & layer.left maybe?)
What you need to do is capture the layer coordinates into global javascript vars (meaning vars not declared inside a function) and at some point get them into a coookie. A google search will yield tons of samples for setting JS cookies. You might set the cookie in the body onUnload event.
Next in the body onLoad event for each page you want to read the cookie and reposition the layer by setting its left and top properties.
Hopefully this will point you towards some puddles to start slogging in ;)