S
S
sadieff2019-10-03 10:15:22
JavaScript
sadieff, 2019-10-03 10:15:22

What is the reason behind this behavior of the vertical slick carousel?

Guys, help, I can not understand what is the reason. They gave me a layout to work with, but I can't overcome the glitch: there is a vertical slick carousel, its items have id's. You need to catch the hash in the address bar and go to the corresponding slide.
Naturally, I pull out the hash, find the index of the desired block before the carousel is initialized. And after initialization, I go to the slide:

// находим index блока
  var services_id = false;
  if(location.hash.substring(1).length > 0) {
    if($('#'+location.hash.substring(1)).length > 0) services_id = $('#'+location.hash.substring(1)).index();		
  }
  
  // запускаем карусель
  
  // переходим к слайду
  if (services_id){	
    $('.service-slider').slick( 'slickGoTo', services_id );
  }


But it works like this: if you FOLLOW a link with a hash, the carousel goes up somewhere.
5d959f91d154c075693391.png
If the open page is UPDATED, it works as it should.
5d959f9c176cc662596920.png
Link to page: deleted

Why is this happening? How to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgenia Chernova, 2019-10-03
@EuaChr

Make a border on the carousel block and you will see that the carousel itself is in place.
But the arrows are styled pressed to the bottom of the carousel block. They remain there all the time while the pictures move to the top.
As an option - recalculate the index of the "first" picture in such a way that there are always enough pictures below so that there is no empty space to the bottom of the carousel block.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question