Skip to content

Instantly share code, notes, and snippets.

@leafnode
Created Mar 13, 2014
Embed
What would you like to do?
scrollAd: function() {
$(window).scroll(function() {
var top = $('#content').offset().top;
var _top = $('#content').position().top;
var scroll = $(window).scrollTop();
if (scroll > top) {
var data = {
'position': 'fixed',
'top': '20px'
};
} else {
var data = {
'position': 'absolute',
'top': _top
};
}
$('#float-ad').css(data);
$('#float-ad-right').css(data);
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment