Returning a CSS element

Posted by TMP on Stack Overflow See other posts from Stack Overflow or by TMP
Published on 2012-06-10T22:20:41Z Indexed on 2012/06/10 22:40 UTC
Read the original article Hit count: 259

Filed under:
|
|

Is there a way to return a CSS element?

I was using Adobe Edge and adding some of my own code in their code tab, but in order to create boundaries I would need to keep track of margin-top or margin-left. The following code works to move the element "woo" but I'm not sure how to call the elements to add something like "|| sym.$("woo").css({"margin-left">0px"}) to the move left code.

//Move RIGHT
if (e.which == 39) {
   sym.$("woo").css({"margin-left":"+=10px"});
}
//Move UP
else if (e.which == 38) {
    sym.$("woo").css({"margin-top":"-=10px"});
}
//Move Left
else if (e.which == 37) {
    sym.$("woo").css({"margin-left":"-=10px"});
}
//Move DOWN
else if (e.which == 40) {
    sym.$("woo").css({"margin-top":"+=10px"});
}

EDIT:

I changed the Left if statement to the following:

else if (e.which == 37 && ($("woo").css("margin-left")>0)) {

It seems to be working to some extent except for now it won't move left at all! I tried doing <0 too in case I was screwing up a sign but it won't let me move the element left either.

© Stack Overflow or respective owner

Related posts about css

Related posts about html5