Add the following Jquery to API & Code / Javascript
// Back to top // $(document).on('knack-scene-render.any', function(event, page) {// Removes any back to top <p> inserted by any previous page rendering or modal pop up
$(“p”).filter(":contains(‘Back to top’)").remove();// inserts a new back to top <p>
$("<p id=‘back-top’><a href=’#top’<span></span>Back to top</a></p>").insertAfter($("#knack-body"))// hide #back-top first $("#back-top").hide(); // fade in #back-top $(function () { $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#back-top').fadeIn(); } else { $('#back-top').fadeOut(); } }); // scroll body to 0px on click $('#back-top a').click(function () { $('#knack-body').animate({ scrollTop: 0 }, 900); return false; }); });
});
Add the following CSS :
/** set the position of the back to top button**//
#back-top {
position: fixed;
bottom: 20px;
right: 10px;
left: auto;
top: auto;
}#back-top a {
width: 108px; height: 108px; display: block; text-align: center; font: 11px/100% Arial, Helvetica, sans-serif; text-transform: uppercase; text-decoration: none; color: #bbb; /* transition */ -webkit-transition: 1s; -moz-transition: 1s; transition: 1s;
}
#back-top a:hover {
color: #000;
}/* arrow icon (span tag) */
#back-top {height: 108px; background: url( /** write here the url of your image**/)}