javascript - How to fit one div to another? -
i want fit div (fade , morph-spinner) base div (name-container). how can it? here code on jsfiddle:
http://jsfiddle.net/nyy8egb0/7
i mean want size fade , morph-spinner in accordance size of name-container.
oh my, there couple of bad things in fiddle, starting this:
function sleep(milliseconds) { var start = new date().gettime(); (var = 0; < 1e7; i++) { if ((new date().gettime() - start) > milliseconds){ break; } } } please, just... don't.
here's better version: http://jsfiddle.net/u6nlj532/
as question, suppose want this:
$("#fade, #morph-spinner") .width($("#name-container").outerwidth()) .css("left", $("#name-container").offset().left); the thing is, you're trying reinvent wheel, there jquery plugin that. see demos here: http://malsup.com/jquery/block/#element
here's version plugin, need style it: http://jsfiddle.net/u6nlj532/2/
Comments
Post a Comment