Answer the question
In order to leave comments, you need to log in
How to replace slick slider content on click?
Hello! There are two Slick sliders. Vertical with thumbnails and large with replacement when clicking on thumbnails. When you click on the button with options, all photos change to others. But then both sliders stop working. Can you please tell me if this can be fixed? Code:
2 Sliders
<div class="option-thumbnails">
<ul class="slider-nav">
<li><img src="slid1.jpg" title="" alt="" /></li>
</ul>
<ul class="slider-for">
<li><img src="slid1.jpg" title="" alt="" /></li>
<li><img src="slid2.jpg" title="" alt="" /></li>
</ul>
</div>
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
fade: true,
asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
slidesToShow: 3,
slidesToScroll: 1,
vertical: true,
asNavFor: '.slider-for',
dots: false,
centerMode: true,
focusOnSelect: true,
useCSS: true,
centerPadding: '100px 0 100px 0',
swipe: true,
touchThreshold: 4
});
$('#product input[type="radio"]').click(function(){
selectvalue($(this).val());
});
function selectvalue(product_option_value_id){
$.ajax({
url: 'some'
type: 'post',
dataType: 'json',
success: function(json) {
if(json['html']){
$('.option-thumbnails').html(json['html']);
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
<ul class="slider-nav">
<li><img src="slid3.jpg" title="" alt="" /></li>
</ul>
<ul class="slider-for">
<li><img src="slid3.jpg" title="" alt="" /></li>
<li><img src="slid4.jpg" title="" alt="" /></li>
</ul>
Answer the question
In order to leave comments, you need to log in
Isn't it easier to make another block with 2 slicks and hide it, and stupidly show it on the button and hide the first set?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question