I have a snippit to alter the margin-left of a node based on a click:
$("#left").click(function(){
var slidewidth = $('#slide_box').attr('width'),
slideleft = $('#slide_box').attr('margin-left');
if (slideleft == 0) {
}
else {
$("#slide_box").animate({"margin-left": "+=135px"}, "fast");
}
});
Now, if slideleft == 0, it shouldn't do anything. But it does. However, when the var slidewidth is calculated, will it return 0 or 0px? How would I define that value in the if argument? When I tried if (slideleft == 0px) it just killed the script.