Scroll to top

## scroll to top::

<style type="text/css">

#plz-ridemeto-top{position:fixed;bottom:20px;right:10px;cursor:pointer;display:none;}

</style>

<script>

$('body').append('<div id="plz-ridemeto-top" class="btn btn-info"><span class="glyphicon glyphicon-chevron-up"></span></div>');




$(window).scroll(function () {

if ($(this).scrollTop() != 0) {

$('#plz-ridemeto-top').fadeIn();

console.log("scrolled");

} else {

$('#plz-ridemeto-top').fadeOut();

console.log("scrolled-faded");

}

});

$('#plz-ridemeto-top').click(function(){

$("html, body").animate({ scrollTop: 0 }, 600);

return false;

});

</script>

Leave a Reply

Your email address will not be published. Required fields are marked *