Giter Site home page Giter Site logo

fveracoechea / sliding-nightmare Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 385 KB

carousel slider, developed 100% with vanilla javascript without external dependencies. It also uses the virtualization of elements which allows having a large number of elements without affecting the performance.

License: MIT License

JavaScript 28.21% CSS 27.14% HTML 44.65%
javascript vanilla-javascript slider carousel virtulization virtualized zero-dependency

sliding-nightmare's Introduction

sliding-nightmare

carousel slider, developed 100% with vanilla javascript without external dependencies. It also uses the virtualization of elements which allows having a large number of elements without affecting the performance.

to see examples click here!

Get Start

$ npm i sliding-nightmare --save

index.html

<section>
  <div class="sliding-nightmare" id="sliding-nightmare">
    <div class="nightmare-inner">
      <!-- Following this structure you can insert any number of "nightmare-item" elements -->
      <div class="nightmare-item">
        <img src="./img/image1.png" alt="image1">
      </div>
      <div class="nightmare-item">
        <img src="./img/image2.png" alt="image2">
      </div>
      <div class="nightmare-item">
        <img src="./img/image3.png" alt="image3">
      </div>
      <div class="nightmare-item">
        <img src="./img/image4.png" alt="image4">
      </div>
    </div>
    <div class="nightmare-controls" role="button">
      <a href="#" class="nightmare-button-prev">
        <span class="nightmare-icon-prev"></span>
      </a>
    </div>
    <div class="nightmare-controls" role="button">
      <a href="#" class="nightmare-button-next">
        <span class="nightmare-icon-next"></span>
      </a>
    </div>
  </div>
</section>
<script src="./node_modules/sliding-nightmare/lib/app.js"></script>
<script src="./app.js"></script>

app.js

window.addEventListener('load', () => {

  new SlidingNightmare('carousel-id');

  // with options
  new SlidingNightmare('sliding-nightmare', { 
    carouselStyles: {
      // compatible with HTMLElement.style - Web API
      height: '120px', // default 70vh
    },
    cover: false, // default true
    numOfVisibleElements: 4, // default 1
    animationDuration: 400, // default 600 ms
    imagesPaddingVertical: '20px', // default 0px
  });
});

sliding-nightmare's People

Contributors

fveracoechea avatar

Stargazers

 avatar

Watchers

 avatar

sliding-nightmare's Issues

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.