change position while scroll code example
Example: change element position after scroll
var header = $('#header');
var ad = $('#ad');
var min_scroll = 25; // Set your minimum scroll amount here
$(window).scroll(
function() {
var t = $(window).scrollTop();
if (t > min_scroll) {
// define your scroll CSS here
header.css({position: "relative"});
ad.css({position: "relative"});
} else {
// define your non-scrolled CSS here
header.css({position: "fixed"});
ad.css({position: "absolute"});
}
}
);