javascript, jQuery: how to save values instead of the references

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-06-01T19:12:03Z Indexed on 2010/06/01 19:13 UTC
Read the original article Hit count: 163

Filed under:
|

hi,

I'm using the following lines to store the location of an object.

var lightboxTop = $('#lightbox').css('top');
var lightboxLeft = $('#lightbox').css('

left');

I'm successively moving this object in my element, and I want to restore it previous position with the stored variables.

But, I'm afraid javascript is saving the values by reference so I lose the initial positions. Am I correct ? How can I solve this ?

thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery