javascript - How to use jQuery variable in css? -
how can use value stored in var height, value on margin-top?
<script> $(document).ready(function(){ var height = $(window).height() / 2; $("a").click(function(){ $("#loader").css({"margin-top:", ***height}); }); }); </script>
thanks in advance...
like this:
<script> $(document).ready(function(){ var height = $(window).height() / 2; $("a").click(function(){ $("#loader").css('margin-top', height+'px'); }); }); </script>
Comments
Post a Comment