The return to top button is displayed when the left side of jquery floats to a certain position

  • 2020-03-30 03:11:04
  • OfStack

 
<script> 
$(function(){ 

$(window).bind('scroll',function(){ 

if ($(document).scrollTop() >200) { 
$(".asd-return").show(1); 
}else{ 
$(".asd-return").hide(1); 
} 
}) 
$(".asd-return").click(function(){ 
$('body,html').animate({scrollTop:0},1000); 
}) 
}) 

</script> 

Related articles: