سؤال

I'm new at jQuery and want to know if its possible to take some variables and get their division as CSS width. So far I'm here:

var x = $(".some-container").length;
var y = $("#some-div").width();
$(".container").css("width", "x / y");

thanks for any help!

هل كانت مفيدة؟

المحلول

$(".container").css("width", (x / y));

OR

$(".container").css("width", function(){
 return (x / y);
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top