tha*_*har -4 javascript css jquery
如何使用存储在var height中的值作为margin-top的值?
<script>
$(document).ready(function(){
var height = $(window).height() / 2;
$("a").click(function(){
$("#loader").css({"margin-top:", ***height});
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
提前致谢...
像这样:
<script>
$(document).ready(function(){
var height = $(window).height() / 2;
$("a").click(function(){
$("#loader").css('margin-top', height+'px');
});
});
</script>
Run Code Online (Sandbox Code Playgroud)