slide.html 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <div id="carousel-container" class="carousel slide">
  2. {php $slides = app_slide(array('multiid'=>$multiid));}
  3. <ol class="carousel-indicators">
  4. {php $slideNum = 0;}
  5. {loop $slides $row}
  6. <li data-target="#carousel-container" data-slide-to="{$slideNum}"{if $slideNum == '0'} class="active"{/if}></li>
  7. {php $slideNum++;}
  8. {/loop}
  9. </ol>
  10. <div class="carousel-inner" role="listbox">
  11. {loop $slides $row}
  12. <div class="item{if $slides[0] == $row} active{/if}">
  13. <a href="{$row['url']}">
  14. <img src="{$row['thumb']}" title="{$row['title']}" style="width:100%; vertical-align:middle;">
  15. </a>
  16. <div class="carousel-caption">
  17. {$row['title']}
  18. </div>
  19. </div>
  20. {/loop}
  21. </div>
  22. </div>
  23. <script>
  24. require(['bootstrap', 'hammer'], function($, Hammer){
  25. $('#carousel-container').carousel();
  26. var mc = new Hammer($('#carousel-container').get(0));
  27. mc.on("panleft", function(ev) {
  28. $('#carousel-container').carousel('next');
  29. });
  30. mc.on("panright", function(ev) {
  31. $('#carousel-container').carousel('prev');
  32. });
  33. });
  34. </script>