Git Product home page Git Product logo

mini-modal's Introduction

#mini-modal mini-modal is intended to be super lightweight and very customizable. Has support for CommonJS and AMD.

##Installation ###via npm

npm install mini-modal

###via bower

bower install mini-modal

##Usage Place this markup somewhere in body, preferrably at the end.

<div id="dialog" class="mini-modal">
    <div data-mini-modal-overlay></div>

    <div data-mini-modal-content>
        <!-- insert your content here -->
        
      
        <!-- close button needs to be somewhere inside of ni-modal__content -->
        <div data-mini-modal-close></div>
    </div>
</div>

Now you can open the dialog like this:

MiniModal.open('dialog');

###with browserify

var MiniModal = require('mini-modal');

MiniModal.open('dialog');

##API

###MiniModal.create(id, options) Returns an instance of MiniModal.

  • id (string): Id to modal element. Pass it without '#'.
  • options (object): Configuration for the MiniModal instance.

###MiniModal.open(id, options) Also returns an instance of MiniModal and opens it immediately.

  • id (string): Id to modal element. Pass it without '#'.
  • options (object): Configuration for the MiniModal instance.

###MiniModal.close() Closes any active modal.

###MiniModal.getActiveModal() Returns MiniModal instance of the currently open modal.

###Options

  • backgroundClickClose (default true): Close modal when clicking on the background overlay.
  • escClose (default true): Close modal when pressing ESC-key.
  • openImmediately (default true): Open modal when Instance is created. If you want to store the MiniModal instance and open it later, set it to false.

###Instance methods ####open() Quite obvious.

####close() Same here.

##Browser Support

  • Firefox
  • Chrome
  • Safari
  • IE9+
  • EDGE
  • Opera

##License Licensed under [MIT][mit].

mini-modal's People

Contributors

diegomorales avatar

Watchers

 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.