JavaScript slickjs always show arrows slick carousel always show arrows

I'm trying to config slick.js to show arrows in any circumstance.

$('.slider-for').slick({
  slidesToShow: 1,
  slidesToScroll: 1,
  arrows: false,
  fade: true,
  asNavFor: '.slider-nav'
});
$('.slider-nav').slick({
  slidesToShow: 6,
  infinite: true,
  slidesToScroll: 1,
  asNavFor: '.slider-for',
  arrows: true,
  centerMode: false,
  focusOnSelect: true
});

The problem is when my slider hasn't enough slides do show (in my case, 6) If the slider has less than 6 slides, the arrows don't show up.

I know the plugin works like that, but for other reasons, i need to always show the arrows.

Anyone had to deal with something like that before ?

Thanks.

Answer:1

You just need to modified slick.js file in the or prevArrow and nextArrow(markup inside) events, check for slide length on init, and if it's 1 then hide the arrows.

Answer:2

I recently saw a listener defined inside method of object bound to nothing. Nice example is this var obj={ shout:function(){ onclick = function(){ alert("hi"); } }...

I recently saw a listener defined inside method of object bound to nothing. Nice example is this var obj={ shout:function(){ onclick = function(){ alert("hi"); } }...

please help me to build following logic, here is code: <button onclick="zoomin()">Zoom In</button> function zoomin(){ var myImg = document.getElementById("img"); var i = 0; i++; ...

please help me to build following logic, here is code: <button onclick="zoomin()">Zoom In</button> function zoomin(){ var myImg = document.getElementById("img"); var i = 0; i++; ...

I've created some sample code below. You can delete items simply by clicking the text you want to delete (or the li element). When you look at the network tab when you delete, you get back both a ...

I've created some sample code below. You can delete items simply by clicking the text you want to delete (or the li element). When you look at the network tab when you delete, you get back both a ...

My authenticate.php file is returning an object Json: [{"u_id":"1","u_name":"Nabeel" }] Here is my js: success: function(result) { var obj=$.parseJSON(result); alert(result); //[{"u_id":"1"...

My authenticate.php file is returning an object Json: [{"u_id":"1","u_name":"Nabeel" }] Here is my js: success: function(result) { var obj=$.parseJSON(result); alert(result); //[{"u_id":"1"...