zlide
about
slider functionality from jQuery.slideToggle
, jQuery.slideUp
, jQuery.slideDown
but with CSS transition on max-height. Same idea as this https://github.com/BrentonCozby/dom-slider but minimalistic. You have to apply css transition styling to your element. Inert is supported. (uses display: none when collapsed)
demo
- Collapsibles with inert support: https://codepen.io/kunukn/full/pWBvEo
- Accordion with inert support: https://codepen.io/kunukn/full/xXePEv
Usage example
Look in dist/index.html for css setup example.
var myElement = document; { console;} { console;} zlide; zlide; zlide;
api
var myElement = document; { console;} { console;}
zlide.up({element: myElement, beforeCallback, doneCallback)
(same aszlide.collapse
)zlide.down({element: myElement, beforeCallback, doneCallback)
(same aszlide.expand
)zlide.toggle({element: myElement, beforeCallback, doneCallback)
zlide.setToCollapsed({element: myElement, beforeCallback, doneCallback)
zlide.setToExpanded({element: myElement, beforeCallback, doneCallback)
cdn
development
- git clone/download project
- npm install
- npm start
- go to localhost:3000
build
- npm run clean
- npm run build
- npm run minify
- look in dist folder
how does it work?
CSS transition on dynamically max-height value and transitionend event.