Scroll To Top Button not working on all the pages
Using Jamroom
Hi Michael,
Our site is still under construction.
As recommended by Brian in the Tutorial, bellow is the code to add in the ready function in the meta.tpl:
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').click(function(){
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
After adding the code, the ready fonction looks like this:
{if isset($javascript_ready_function)}
<script type="text/javascript">
$(document).ready(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').click(function(){
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
{$javascript_ready_function}return true;
});
</script>
{/if}
Putting the code in the ready function in the meta.tpl works in few pages only (admin pages), only on pages where the ready function is called.
This is because other pages from the frontend like: index, profile, audio, video etc do not load the ready fonction in the meta tag.
Any help?
Thanks