Giter Site home page Giter Site logo

tunui / dom-slider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brentoncozby/dom-slider

0.0 0.0 0.0 70 KB

Plain JavaScript version of jQuery's slideToggle(), slideDown(), & slideUp(), but does not use display: none.

License: Other

CSS 6.37% HTML 22.97% JavaScript 70.67%

dom-slider's Introduction

dom-slider

Known Vulnerabilities

It works like jQuery's slideToggle(), slideDown(), & slideUp(), but does not use display: none. Uses CSS3 transitions and element.scrollHeight to animate the height of elements with an unknown height.

dom-fader is a thing too.

Features:

  • Slides elements with a known or unknown height
  • Slides the height, padding, border, and margin (just the top and bottom values).
  • May slide multiple elements at once
  • Returns a Promise resolved with the element
  • Hides elements in a screen-reader-friendly way
  • Zero Dependencies and written in plain JavaScript (compiled to ES5)

Example Usage:

First, place the dom-slider.js file in your code somewhere. Then do stuff like below:

import 'dom-slider' // if using ES6 modules

const box = document.querySelector('.box')

box.slideToggle()

box.slideUp(1200)

box.slideDown(800, 'easeInOut')

box.slideDown(500).slideUp(300)

box.slideUp().then(function() {
  console.log('Done sliding!')
})

Install:

npm install --save dom-slider

or include a script tag with the file served from a CDN:

<script src="https://cdn.rawgit.com/BrentonCozby/dom-slider/5af8b397/dist/dom-slider.js"></script>

Options:

No arguments required, but you may give the following arguments to slideToggle, slideDown, and slideUp:

slideDown(speedInMilliseconds, CSSTransitionTimingFunction, delayInMilliseconds)

Print Styling:

dom-slider removes the DOM-slider-hidden CSS class from all elements before printing.

dom-slider's People

Contributors

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