bongzilla

Untitled

May 5th, 2022
2,437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.55 KB | None | 0 0
  1. $(document).ready(function() {
  2.     const reviewsBlockId = "#reviews-block";
  3.     const isPageHaveReviewsBlock = $(reviewsBlockId).length > 0;
  4.     const reviewsLink = $(`a[href="/otzyvy/"]`);
  5.     const reviewsBlockPosition = $(reviewsBlockId).eq(0).offset().top;
  6.    
  7.     reviewsLink.on("click", function(e) {
  8.         if (isPageHaveReviewsBlock) {
  9.             e.preventDefault();
  10.             $("html, body").animate({
  11.                 scrollTop: reviewsBlockPosition
  12.             }, 1000);
  13.         } else {
  14.             return true
  15.         }
  16.     });    
  17. });
Advertisement
Add Comment
Please, Sign In to add comment