jquery - how to change margin when the image width changes? -
i have fixed header , when resize browser window logo on header resizes , want change margin of logo when image resized how do that?
this jquery use resize image
$(window).on('load resize', function() { var maxsize = 2560; var screenwidth = $(this).width(); var factor = 0.27*screenwidth-(maxsize-screenwidth)*0.05; if (factor > 2560) factor = 2560; $('#logo').css('width', factor) }); });
css: #logo{ margin-top:5px; margin-left:10px; float:left; cursor: pointer; display:block; min-width:220px; height: auto; width: auto\9; /* ie8 */ }
Comments
Post a Comment