V
V
Vasily Khryagin2020-12-30 15:39:46
JavaScript
Vasily Khryagin, 2020-12-30 15:39:46

How to make anchors on slick-slider slides from another page?

I have a page where all sections are slides. And I need that from another page, when clicking on the anchor link, it loads a page with these sectional slides and scrolls to the desired slide. Please tell me how to do it?
With anchors that are on the same page as the slides, there are no problems. But from other pages, I have no idea how to scroll to the desired slide.

// anchor slick
$('a[data-slide]').click(function(e) {
  e.preventDefault();
  var slideno = $(this).data('slide');
  $('.homepage main').slick('slickGoTo', slideno - 1);
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Il'ia Kartovitskii, 2020-12-30
@kartovitskii

There is a parameter in slick (initialSlide it seems) responsible for the starting number of the slide, respectively, you need to set the parameter value before initializing the slider

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question