.on() selector and load event not triggering
Firstly, here's my code:
- scrollTop = {
init: function () {
scrollTop.attachHandlers();
},
attachHandlers: function () {
$('body').on('load', goToTop);
function goToTop() {
if ($(document).height() > $(window).height()) {
$('body a.nav-top').show();
}
}
}
};
I need to call gotoTop on initial page load and postbacks because its is comparing the size of the current page, however, the line $('body').on('load', goToTop); is not triggering on either occasion,
Can any help?