JQuery css "+ =" not working
I have a <div>
:
<div class="ball" style="top: 1px;"></div>
The top
property is set using the jQuery .css
function as follows:
$( ".ball" ).css( { top : var_top } );
However, when I try to increase it using this syntax, it does not work:
$( ".ball" ).css( { top : "+=" + var_top } );
I even tried it in the Firebug console as follows:
$( ".ball" ).css( { top : "+=7px" } ); $( ".ball" ).css( { top : "+=7" } );
but none of them work.
+4
2 answers