0

I'm setting a click function to open a tab but on click it scrolls the page down which I don't want to happen. How can I stop the scroll?

$(window).bind("load", function() {

  if ($('.feefo-review-widget-product').get(0)) {
    if ($('.feefo-review-widget-product').get(0).shadowRoot.innerHTML.length < 1000) {
      $(".data.item.title.feefo.reviews").insertAfter(".tab-content.product.info.delivery");
      $(".tab-content.feefo.reviews").insertAfter($(".data.item.title.feefo.reviews"));

      setTimeout(function() {
        $('div#tab-label-description').click()
      }, 100);
    }
  }
});
2
  • I don't see anything here that would scroll the page by itself. Maybe there's a click handler on #tab-label-description that does this. Commented Aug 22 at 19:18
  • BTW, the more common way to tell if a selector matches anything is with if ($('selector').length > 0) Commented Aug 22 at 19:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.