popin
Create your custom popin.
You can use this module with browserify
and require('popin')
.
How it works
The plugin will look for all element who have the js-popin class and bind it to open a div with an id equal to the data-target or a content past in params.
Example :
test popin Fermer X <!-- popin content goes here -->
Installation
You can use the minified file in lib/popin.js for production or if you use Browserify, you just have to require('popin')
and npm i
Setup
Simply create a new instance of the Popin object.
var Popin = ; document;
CSS
Copy the styles in styles/popin.scss
in your css or import the file in your scss.
Defaults parameters
var defaultParams = { overlay : true }
Use custom init params
var popinInstance = overlay:false //to disable overlay for all popins;
Defaults options
var defaultOptions = { className : "js-popin", //css class overlayVisible : true, //show the overlay for the popin closeButton : true //the popin have close button }
Use custom init options
You can use a custom class to trigger your popin, in the initialisation you just need to pass an object like this :
popinInstance;
test popin
callback
You have 4 callback options
popinInstance;
Support
This module uses classList who isn't available on IE9 and below, if you have to play around just use a polyfill 😄