Ok so I have one div and inside it a canvas. from my html file:
<div id="container">
<canvas id="game" width="600px" height="2000px"></canvas>
</div>
from css file:
#game{
/*background-color: #99CC00;*/
background:-moz-linear-gradient(top, #00b7ea 0%, #008793 14%, #004b9b 43%, #1f00ea 74%, #008793 89%, #009ec3 100%);
bottom: 0px;
position: absolute;
}
#container{
position: relative;
width: 600px;
height: 500px;
}
What i want to do is to control the 'bottom' value of #game that is:
($("#game").css("bottom")),
To put it in an if statement and if true, to change it automatically.
But when I try there is a problem that I cannot understand.
I have a variable called s. Where s will be the amount that should be changed, it's not a fixed number.
when I tried ($("#game").css("bottom", -s));
nothing happened, so to check it I did the following:
alert( ($("#game").css("bottom", -s)) ); the reply was [object Object].
while if I just do alert( ($("#game").css("bottom")) ); the reply is correctly 0px.
What am I missing? Help would be much appreciated!
parseInt()onsto ensure that it's numeric?px-$("#game").css("bottom", -s + 'px')