You can try that :
var $scrollingDiv = $("#container"),
defaultHeight = parseInt($scrollingDiv.css('height')); // whatever is in your css as
$(window).scroll(function() {
var winScrollTop = $(window).scrollTop() + 0,
zeroSizeHeight = $(document).height() - $(window).height(),
newSize = defaultHeight * (1 - (winScrollTop / zeroSizeHeight));
$scrollingDiv.css({
height: newSize,
"marginTop": winScrollTop + "px"
}, 500, 'easeInOutSine');
});