jQuery(function() {
var box = jQuery('.example'); // float-fixed block
var top = box.offset().top - parseFloat(box.css('marginTop').replace(/auto/, 0));
jQuery(window).scroll(function(){
var windowpos = jQuery(window).scrollTop();
if(windowpos < top) {
box.css('position', 'static');
} else {
box.css('position', 'fixed');
box.css('top', 0);
}
});
});