Created
March 13, 2014 18:44
-
-
Save leafnode/9534314 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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