JAVASCRIPT   71

wp-smooth-scroll.js

Guest on 29th August 2021 02:50:58 PM

  1. jQuery.noConflict();
  2. jQuery(function($) {   
  3.         $('#wp-smooth-scroll').hide();
  4.         $(window).on( 'scroll', false, function() {
  5.                 var windowTop = $(window).scrollTop();
  6.                 if (windowTop > 200 ) {
  7.                         $( '#wp-smooth-scroll' ).slideDown('slow');
  8.                 }
  9.                 else{
  10.                         $('#wp-smooth-scroll').slideUp('slow');
  11.                 }
  12.         });
  13.  
  14.         // Scroll to the top when the back-to-top is clicked.
  15.         $('#wp-smooth-scroll').on('click',function(){
  16.                 $('html, body').animate({scrollTop:0}, 'slow');
  17.         });
  18. });

Raw Paste


Login or Register to edit or fork this paste. It's free.