0

if ($(window).width() < 767) {
  $('a[href*="#"]:not([href="#"])').click(function() {
   var offset = -500; // <-- change the value here
   if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
    var target = $(this.hash);
    target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
    if (target.length) {
     $('html, body').animate({
      scrollTop: target.offset().top + offset
     }, 1000);
     return false;
    }
   }
  });
 }

Jagdish Sarma Asked question March 19, 2022
Add a Comment