I was working on stopping the adbanner at a certain point before footer. And played with the code I found above.
Worked for me (banner disappears right before footer and reappears on scroll to top):
<style>
#leftsidebanner {width:300px;height:600px;position: fixed; padding: 0;top:288px;right:5%;display: block;background-color: aqua}
</style>
<div id="leftsidebanner">
</div>
<script>
$.fn.followTo = function (pos) {
var stickyAd = $(this),
theWindow = $(window);
$(window).scroll(function (e) {
if ($(window).scrollTop() > pos) {
stickyAd.css({'position': 'absolute','bottom': pos});
} else {
stickyAd.css({'position': 'fixed','top': '100'});
}
});
};
$('#leftsidebanner').followTo(2268);
</script>