Hello to all the forum, I have a very long Grid that contains images and text, I would like to add a floating Back to Top Button, I found several examples in internet,I insert the code attached in onApplicatioInit. But nothing happens.
Can anyone tell me where is the problem.
Thank you for your reply.
Link: http://www.yourwebtech.info/tutorial…n-with-jquery/
Here is the code:
$_Back_To_Top="
<style>
.to-top-btn {
position: fixed;
bottom: 20px;
right: 30px;
text-decoration:none;
background: #FFFFFF;
color: #454440;
padding: 10px;
border-radius: 5px;
display: none;
}
</style>
<script src=’…/…/…/js/jquery.min.js’></script>
<a href=’#’ >
<img src=’…/…/…/file/img/up-arrow.png’ alt=‘back-to-top’>
</a>
<script>
jQuery(function($) {
//lets handle the button click event
$(’.to-top-btn’).on(‘click’, function(e) {
$(‘body, html’).stop().animate({scrollTop: 0}, ‘slow’, ‘swing’);
e.preventDefault();
});
//lets show the button when the page scroll to about 400 pixels
//change the value to your desired offset
$(window).scroll(function() {
if($(window).scrollTop() > 400){
//show the button when scroll offset is greater than 400 pixels
$(’.to-top-btn’).fadeIn(‘slow’);
}else{
//hide the button if scroll offset is less than 400 pixels
$(’.to-top-btn’).fadeOut(‘slow’);
}
});
});
</script>
";
echo $_Back_To_Top;