You can do something like this:
var width = $(window).width() - 25; $("#mydiv").width(width);
25 is just a sample number, for example, your stock (you can also get this dynamically)
You can also put it in a function and call it both when the page loads, and when resizing
Andre
source share