Looking to implement a sticky menu for my blog using jQuery. The menu is functioning as desired, however, the issue arises when I scroll down on a page that contains adsense - the menu ends up going under the ad.
What could be causing this problem?
Below is the jquery function I am using:
$(function(){
var stickyRibbonTop = $('#mainmenu').offset().top;
$(window).scroll(function(){
if( $(window).scrollTop() > stickyRibbonTop ) {
$('#mainmenu').css({position: 'fixed', top: '0px'});
} else {
$('#mainmenu').css({position: 'static', top: '0px'});
}
});
});
Additionally, you can view the code in action on this fiddle: http://jsfiddle.net/7zb920bb/