GithubHelp home page GithubHelp logo

xakep-sava / owlcarousel2-thumbs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gijsroge/owlcarousel2-thumbs

1.0 1.0 0.0 49 KB

Enables thumbnail support for Owl Carousel 2.2.1

License: MIT License

JavaScript 100.00%

owlcarousel2-thumbs's Introduction

Owl Carousel 2 Thumbnails plugin (Fixed Thumbs Owl Slider)

Enables thumbnail support for Owl Carousel 2.2.1

Added carousel for thumbs

Quick start

  1. initialize owl carousel;
  2. initialize thumbs carousel.

Screenshot:

Alt text

Example:

// initialize owl carousel

$(window).on('load', function () {
  var $owlThumbs = $('.owl-thumbs');
  if($owlThumbs.length && $owlThumbs.find('button').length > 1) {
    $owlThumbs.owlCarousel({
      autoplay: false,
      loop: true,
      nav: true,
      navText: [' ', ' '],
      dots: false,
      items: 7,
      margin: 0,
      thumbs: false,
      thumbImage: false,
      loadedClass: 'owl-carousel owl-loaded',
      responsive : {
          0 : {
              items : 3
          },
          380 : {
              items : 4
          },
          480 : {
              items : 5
          },
          590 : {
              items : 6
          },
          640 : {
              items : 7
          },
          768 : {
              items : 3
          },
          880 : {
              items : 4
          },
          992 : {
              items : 7
          }
      }
    });
  }
});
Enable thumbs
$(document).ready(function(){
  $('.owl-carousel').owlCarousel({
    thumbs: true
  });
});

Use pre-rendered html as thumbnails. recommended

$(document).ready(function(){
  $('.owl-carousel').owlCarousel({
    thumbs: true,
    thumbsPrerendered: true
  });
});
Add thumbnails (link slider and thumbnails with data-slider-id attribute)
<div class="owl-carousel" data-slider-id="1">
    <div>Your Content</div>
    <div>Your Content</div>
    <div>Your Content</div>
    <div>Your Content</div>
</div>
<div class="owl-thumbs" data-slider-id="1">
    <button class="owl-thumb-item">slide 1</button>
    <button class="owl-thumb-item">slide 2</button>
    <button class="owl-thumb-item">slide 3</button>
    <button class="owl-thumb-item">slide 4</button>
</div>

Or add data-thumb attribute to your slides

<div class="owl-carousel">
    <div data-thumb='Content of your thumbnail (can be anything)'> Your Content </div>
    <div data-thumb='Content of your thumbnail (can be anything)'> Your Content </div>
    <div data-thumb='Content of your thumbnail (can be anything)'> Your Content </div>
    <div data-thumb='Content of your thumbnail (can be anything)'> Your Content </div>
</div>

Available options

$(document).ready(function(){
  $('.owl-carousel').owlCarousel({
    // Enable thumbnails
    thumbs: true,
  
    // When only using images in your slide (like the demo) use this option to dynamicly create thumbnails without using the attribute data-thumb.
    thumbImage: false,

    // Enable this if you have pre-rendered thumbnails in your html instead of letting this plugin generate them. This is recommended as it will prevent FOUC
    thumbsPrerendered: true,
    
    // Class that will be used on the thumbnail container
    thumbContainerClass: 'owl-thumbs',
    
    // Class that will be used on the thumbnail item's
    thumbItemClass: 'owl-thumb-item'
  });
});

owlcarousel2-thumbs's People

Contributors

gijsroge avatar mi2oon avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.