Thank you, Marius, appreciate it. I got it to work after reading the Binding Click Events section. I totally missed that, because I thought it related to the "newpageshown" stuff above. Always read the manual...
A follow-up question, if I may. I can't seem to get my menu button to drop down at the exact same time as the Lay theme navbar. Mine is close, but if you scroll down a tiny bit using the scroll bar you can see it's a little off. I'm using the same transition transition: top 350ms ease, bot 350ms ease;
but the issue is finding the precise scroll amount where the menu shows/hides. But maybe you are using a totally different approach and it's not really comparable :) if so, I'll just say this is good enough.
This is my code
<!-- Hide and show menu on scroll -->
<script>
var didScroll;
var lastScrollTop = 0;
var delta = 40;
var navbarHeight = jQuery('#menuHeight').outerHeight();
jQuery(window).scroll(function(event){
didScroll = true;
});
setInterval(function() {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 50);
function hasScrolled() {
var st = jQuery(this).scrollTop();
if(Math.abs(lastScrollTop - st) <= delta)
return;
if (st > lastScrollTop && st > navbarHeight){
// Scroll Down
jQuery('#menuHeight').removeClass('showmenu').addClass('hidemenu');
} else {
// Scroll Up
if(st + jQuery(window).height() < jQuery(document).height()) {
jQuery('#menuHeight').removeClass('hidemenu').addClass('showmenu');
}
}
lastScrollTop = st;
}
</script>