Hi , I have a such code just entering start part for you
$(document).ready(function(){
//Dynamically size wrapper div based on image dimensions
$("#tag-wrapper").css({width: $("#show_img").outerWidth(), height: $("#show_img").outerHeight()});
//Append #tag-target content and #tag-input content
$("#tag-wrapper").append('<div id="tag-target"></div><div id="tag-input"></div>');
Idea is that the css properties should immediately take place when the page is loaded. But... When I enter first time to the page, it doesnt work, when I refresh the page it works like it should. Any Idea how I can fix that?