0

I'm working on this site http://www.lubittar.com/ which uses swipe.js - visit Timeline in the menu. I've followed the example almost exactly but the next and prev buttons are not working. If I add auto: 3000 to the script it works but the button functions are not being seen for some reason.

<div id='mySwipe' class='swipe'>
    <div class='swipe-wrap'>
    <div>content</div>
    <div>content</div>
    <div>content</div>
</div>

<div style='text-align:center;padding-top:20px;'>
  <button onclick='mySwipe.prev()'>prev</button> 
  <button onclick='mySwipe.next()'>next</button>
</div>

at the bottom of the page

<script src='swipe.js'></script>
<script>
    var elem = document.getElementById('mySwipe');
    window.mySwipe = Swipe(elem, {

    });
</script>
user3219182
  • 69
  • 2
  • 10

1 Answers1

0

You need to close your swipe-wrap div like the code below, otherwise the browser probably is interpreting that the buttons are inside the swiper div and they don't work correctly.

  <div id='mySwipe' class='swipe'>
    <div class='swipe-wrap'>
        <div>content</div>
        <div>content</div>
        <div>content</div>
    </div>
</div>

<div style='text-align:center;padding-top:20px;'>
  <button onclick='mySwipe.prev()'>prev</button> 
  <button onclick='mySwipe.next()'>next</button>
</div>
Javier Abrego
  • 462
  • 3
  • 12