V
V
vik73352018-05-17 07:13:41
JavaScript
vik7335, 2018-05-17 07:13:41

The slider does not immediately load images?

There is a slider. When the page loads, all pictures (4 pcs) are displayed. As soon as we click on the button of another month, another slider opens, but for some reason only one picture is loaded and not all. If you scroll through the slider, then everything is loaded. And so with all the hidden sliders. if you return to them after and press the button of any slider again, then all the pictures are displayed. Slider I use slick. Site onhome.devshift.co.uk .
The code responsible for hiding and showing the sliders.

$('.slider_btn').click(function(){ 
   	//Шаг 1. Выключаем вообще все слайдеры 
           console.log('mark1');
   	$('.slider_work').each(function(){ 
            console.log('mark2');
   		$(this).removeClass('active'); 
        }); 
   	//Шаг 2. Получаем id категории и ставим её на айдишник слайдера 
   	var slider_id = $(this).attr('id'); 
           
           console.log(slider_id);
           
   	slider_id = slider_id.replace("btn_", "#slider_"); 
   	//Шаг 3. Включаем слайдер с нужной категории 
           
           console.log(slider_id);
           
   	$(slider_id).addClass('active'); 
   	//$('#slider_12').addClass('active'); 
   	});


5afcfd6c1b354171520267.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Chefranov, 2018-05-17
@vik7335

You probably have a slider for one class or an id is hung, or you change the class / id in the course of switching tabs. It is necessary to reinitialize it by clicking on the tab

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question