javascript - How to set a CSS property with a variable in JQuery? -
i need set css property of width same size browser's current width. this, did var setwidth = $(window).width()
, don't know how apply current code, this:
$(document).ready(function(){ $("#backgroundimg").css("width", ""); });
is there way this? i'm new jquery might amateur.
try this
$(document).ready(function() { var setwidth = $(window).width(); $("#backgroundimg").css("width", setwidth + 'px'); });
or can use $.width
$(document).ready(function() { $('#backgroundimg').width( $(window).width() ) });
Comments
Post a Comment