title: How to conditionally add next and prev arrows based on slick carousel width?
body: <p>I am attempting to add the next and prev arrows for the <a href="https://github.com/kenwheeler/slick" rel="nofollow noreferrer">Slick Carousel (latest version)</a> conditionally when the content takes up more space then the outer container (<code>&lt;div class="container"&gt;</code>). </p>
  
  <p>Example:</p>
  
  <ol>
  <li>Content fits inside container (expected results)</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/ZY1xp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZY1xp.png" alt="does not take up container"></a></p>
  
  <ol start="2">
  <li>Content does not fit inside container (expected results)
  <a href="https://i.stack.imgur.com/iDyiC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iDyiC.png" alt="does not fit container"></a></li>
  </ol>
  
  <p>Goal:</p>
  
  <ul>
  <li>If the content overflows beyond the container then add the arrows else do not</li>
  </ul>
  
  <p>Here is what I have setup but it does not work to add the arrows conditionally. </p>
  
  <ul>
  <li>This code highlights the current results and issue. </li>
  <li>I have attempted to use the responsive setting but that will always add the arrows if the breakpoint is met, which is not what i want</li>
  </ul>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() {
    $('.carousel').slick({
      focusOnSelect: true,
      arrows: true,
      infinite: false,
      
      variableWidth: true,
      prevArrow: '&lt;div class="prev-arrow"&gt;&lt;i class="fa fa-angle-left fa-2x" aria-hidden="true"&gt;&lt;/i&gt;&lt;/div&gt;',
                  nextArrow: '&lt;div class="next-arrow"&gt;&lt;i class="fa fa-angle-right fa-2x" aria-hidden="true"&gt;&lt;/i&gt;&lt;/div&gt;',
    });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.carousel {
    color: black;
    display: block;
  }
  
  .carousel .item {
    border: 1px solid white;
    margin: 0 10px;
    padding: 5px;
  }
  
  .slick-list {
   width: auto;
   margin: 0 auto;
   height: auto;
  }
  
  .item.slick-current {
    border-bottom: 2px solid black;
  }
  
  .prev-arrow {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  }
  
  .next-arrow {
  position: absolute;
  right: 0;
  z-index: 10;
  top: 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!-- Latest compiled and minified CSS --&gt;
  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.css"&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css"&gt;
  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"&gt;
  &lt;!-- jQuery library --&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;!-- Latest compiled JavaScript --&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"&gt;&lt;/script&gt;
  
  
  &lt;div class="container"&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-md-12"&gt;
  
        &lt;div class="carousel"&gt;
          &lt;div class="item"&gt;
            tab 1
          &lt;/div&gt;
          &lt;div class="item"&gt;
            tab 2
          &lt;/div&gt;
          &lt;div class="item"&gt;
            tab 3
          &lt;/div&gt;
          &lt;div class="item"&gt;
            tab 4
          &lt;/div&gt;
          &lt;div class="item"&gt;
            tab 5
          &lt;/div&gt;
          &lt;div class="item"&gt;
            tab 6
          &lt;/div&gt;
        &lt;/div&gt;
  
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Current output:</p>