This is a simple jQuery plugin that allows you to turn any element into fixed position only when the screen scrolls to it.
// Basic usage
$('.element').sometimes();
// Optional styles parameter
$('.element').sometimes({
'right': 0,
'background': 'green',
'height': '200px'
});