Coder Social home page Coder Social logo

jekylltools / jekyll-ideal-image-slider-include Goto Github PK

View Code? Open in Web Editor NEW
43.0 0.0 44.0 995 KB

Add image sliders to Jekyll with Ideal Image Slider. HTML include version. Github Pages compatible. (This repository is archived. Issues are disabled. Pull requests will be ignored.)

License: MIT License

HTML 100.00%
jekyll jekyll-blog image-slider javascript slider

jekyll-ideal-image-slider-include's Introduction

Jekyll Ideal Image Slider Include

Add image sliders to Jekyll with Ideal Image Slider. HTML include version. No plugin necessary. Fully compatible with Github Pages.

View a live demo running on Github Pages. The code and configuration for the demo is in the gh-pages branch.

Installation

  1. Add Ideal Image Slider files to your site.

  2. Add _data/sliders.yml to your site.

  3. Add the _includes folder and all contents to your site.

  4. Include slider_styles.html in your theme head. Change the paths in this file to the location of the styles in your site.

    {% include slider_styles.html %}

  5. Include slider_scripts.html in your theme just before the </body> tag. Change the paths in this file to the location of the scripts in your site.

    {% include slider_scripts.html %}

Usage

Create a slider by adding data to _data/sliders.yml, adding a selector to the image_sliders front matter variable and including slider.html while passing in the slider selector. View the code in the gh-pages branch for a live example.

1. Create slider data

Create a slider by adding data to _data/sliders.yml. The format for slider data is shown below. See the Ideal Image Slider settings for a description of each setting. Note that bullets and captions are boolean (true/false) and classes is unsupported.

- selector:
  bullets:
  captions:
  images:
    - data-src:
      data-src-2x:
      src:
      title:
      alt:
      href:
  settings:
    height:
    initialHeight:
    maxHeight:
    interval:
    transitionDuration:
    effect:
    disableNav:
    keyboardNav:
    previousNavSelector:
    nextNavSelector:

Here is an example slider, with some images, alt text and captions:

- selector: example_slider
  captions: true
  images:
    - src: /img/1.jpg
      alt: image one
    - src: /img/2.jpg
      alt: image two
    - src: /img/3.jpg
      alt: image three
  settings:
    height: "'auto'"
    effect: "'fade'"

2. Add image_sliders front matter variable

Use the image_sliders variable to add slider selectors to the front matter of a page or layout. This tells Jekyll to load the correct slider scripts and styles on that page or layout:

image_sliders:
  - example_slider

3. Include slider.html

Include slider.html where you want the slider to appear within the page or layout. Pass the slider selector into the include. This tells Jekyll to search in _data/sliders.yml for slider data where the selector equals example_slider and use that data to create an image slider:

{% include slider.html selector="example_slider" %}

Sliders on index and archive pages

Set image_sliders_load_all: true in the front matter of an index page or archive page to load sliders in post content displayed on that page. For example if you are displaying post excerpts on your home page, set image_sliders_load_all: true and any image sliders appearing within post excerpts will load correctly on your home page.

jekyll-ideal-image-slider-include's People

Contributors

jekylltools avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.