Reputation: 1065
Using jQuery's window resize function, is there a way to create these two functions.
It will keep the page-wraps width where it's at, during the resize. Thus, we would lock everything in place until the resize & it's resize timer event is over.
Once it is over, the width will .animate smoothly to new window width...
inspiration is http://bit.ly/kDurZ4
Upvotes: 0
Views: 460
Reputation: 972
Something like this should get you started.
$(window).resize( function() {
function smoothResize() {
// animate the width on resize
$('#container').animate({
'width' : $(window).width()-15
});
}
// This calls the function 'smoothResize' when the browser has finished resizing
clearTimeout(this.id);
this.id = setTimeout(smoothResize, 50);
});
You will need some if's to detect screen size and whether the div is within the constraints and needs to be resized.
Upvotes: 2