Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Baguettebox doesn't show next/previous stepper

I'm using baguettebox for image viewer. The problem is, everything works except the "next/previous" buttons. So I can't go to the next image.

 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>

<script>
   baguetteBox.run('.labrador');
</script>

and the html:

<div class="labrador">
      <a href="img/portfolio/cabin.png"
       data-at-450="img/portfolio/blog.jpg"
       data-at-800="img/portfolio/cake.png"
       data-at-1366="img/portfolio/circus.png"
       data-at-1920="img/portfolio/blog.jpg">
<button type="button" class="btn btn-primary" href="#">Images</button>
            </a>
          </div>

My result: https://i.gyazo.com/3e9bad7f104794962a31b8ef13ce0891.png

As you can see, there aren't next/prev buttons, only the X which works fine.

like image 792
Mower Avatar asked Jun 01 '19 09:06

Mower


2 Answers

in your script add this {buttons: true} in baguetteBox try this

baguetteBox.run('.labrador',{
  buttons: true
});

baguetteBox.run('.labrador',{
  buttons: true
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link href="https://feimosi.github.io/baguetteBox.js/css/baguetteBox.css" rel="stylesheet"/>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>
  
  <div class="labrador">
      <a href="https://feimosi.github.io/baguetteBox.js/img/thumbs/4-1.jpg"
       data-at-450="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-1.jpg"
       data-at-800="https://feimosi.github.io/baguetteBox.js/img/thumbs/4-3.jpg"
       data-at-1366="https://feimosi.github.io/baguetteBox.js/img/thumbs/4-4.jpg"
       data-at-1920="https://feimosi.github.io/baguetteBox.js/img/thumbs/4-2.jpg">
<button type="button" class="btn btn-primary" href="#">Images</button>
            </a>
             <a href="https://feimosi.github.io/baguetteBox.js/img/thumbs/2-1.jpg"
       data-at-450="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-1.jpg"
       data-at-800="https://feimosi.github.io/baguetteBox.js/img/thumbs/4-3.jpg"
       data-at-1366="https://feimosi.github.io/baguetteBox.js/img/thumbs/4-4.jpg"
       data-at-1920="https://feimosi.github.io/baguetteBox.js/img/thumbs/4-2.jpg">
            </a>
          </div>

check this example

baguetteBox.run('.labrador',{
  buttons: true
});
img{
          height:50px;
          margin:10px 0;
        }
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    <link href="https://feimosi.github.io/baguetteBox.js/css/baguetteBox.css" rel="stylesheet"/>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
      <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js"></script>
      
         <div class="labrador">
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-1.jpg" data-caption="Golden Gate Bridge">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-1.jpg" alt="Golden Gate Bridge">
        </a>
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-2.jpg" title="Midnight City">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-2.jpg" alt="Midnight City">
        </a>
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-3.jpg">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-3.jpg" alt="">
        </a>
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-4.jpg">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-4.jpg" alt="">
        </a>
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-5.jpg">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-5.jpg" alt="">
        </a>
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-6.jpg">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-6.jpg" alt="">
        </a>
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-7.jpg">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-7.jpg" alt="">
        </a>
        <a href="https://feimosi.github.io/baguetteBox.js/img/1-8.jpg">
            <img src="https://feimosi.github.io/baguetteBox.js/img/thumbs/1-8.jpg" alt="">
        </a>
    </div>
like image 100
Udhay Titus Avatar answered Nov 02 '22 07:11

Udhay Titus


Try the below code or visit this link: https://www.cssscript.com/simple-gallery-lightbox-with-javascript-and-css3-baguettebox-js/

baguetteBox.run('.labrador', {
  captions: true, // display image captions.
  buttons: 'auto', // arrows navigation
  fullScreen: false,
  noScrollbars: false,
  bodyClass: 'baguetteBox-open',
  titleTag: false,
  async: false,
  preload: 2,
  animation: 'slideIn', // fadeIn or slideIn
  verlayBackgroundColor: 'rgba(0,0,0,.8)'
});
like image 1
Njabulo Mlangeni Avatar answered Nov 02 '22 07:11

Njabulo Mlangeni