Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Owl-carousel: Displaying only one image per slide

Today I discovered owl-carousel and I have been trying to get it to work.

I'm trying to make a carousel that cycles through images of dinosaurs. The problem is that 4 dinosaurs show up on the same slide(2 in the fiddle half-sized window). I wanted only 1 to show up per slide.

I have a fiddle

http://jsfiddle.net/8bJUc/318/

JavaScript

<script>
    $(document).ready(function(){
        $("#dino-example").owlCarousel({
            items: 5
        });
    });
</script>

HTML

<div id="dino-example" class="dino-carousel">
  <div class="item">
    <img src="http://johntomsett.files.wordpress.com/2014/03/14525_1_v12_tp.jpg" alt="dinosaur1"></img>
  </div>
  <div class="item">
    <img src="http://images.clipartpanda.com/t-rex-dinosaur-clip-art-T-Rex-Dinosaur_1.png" alt="dinosaur2"></img>
  </div>
  <div class="item">
    <img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQbuwkU3kDpr4rByYQ3ydbTPv6zP1L0yhrKB00fa5YhkY0i9WKFWA" alt="dinosaur3"></img>
  </div>
  <div class="item">
    <img src="http://content.animalnewyork.com/wp-content/uploads/new-dinosaur-nasutoceratops.jpg" alt="dinosaur4"></img>
  </div>
</div>

CSS

img {
  height: 300px;
  width: 300px;
}

I tried changing items to 1, but that didn't solve it either.

Does anyone know how to solve this?

Help is appreciated.

like image 633
Richard Hamilton Avatar asked May 27 '15 23:05

Richard Hamilton


People also ask

How do you turn off auto slide on owl carousel?

In order to stop owl auto play you can trigger the corresponding event: stop. owl.

How do you make a slider with owl carousel?

Responsive Owl-carousel Slider [Source Codes] First, you need to create two Files one HTML File and another one is CSS File. After creating these files just paste the following codes in your file. First, create an HTML file with the name of index. html and paste the given codes in your HTML file.

How do you hide the dots in owl carousel?

This also says pagination (dots) can be turned off with: pagination: false, The dots: false, is for version 2.


1 Answers

singleItem property needs to be true

$(document).ready(function() {
      $("#dino-example").owlCarousel({
            items: 5,
            singleItem: true
        });
    });
like image 128
Josh Stevens Avatar answered Oct 14 '22 10:10

Josh Stevens