Git Product home page Git Product logo

confirmodal's Introduction

ConfirModal

ConfirModal is a dependency–free, lightweight JS library for displaying confirmation modal boxes.

When called, it displays a modal confirmation box based on the options passed to it that you can then style with your own CSS.

##Usage

Include confirmodal.js in your JavaScript bundle, or add it to your HTML page like this:

<script type='application/javascript' src='/path/to/confirmodl.js'></script>

The script must be loaded before attempting to call ConfirModal.

To initiate your modal, this is currently the recommended method of use:

window.addEventListener('load', function() {
    ConfirModal({
	…
    });
}, false);

Don't forget to add a shim for addEventListener if you want to support IE8 and below.

If you’re using Browserify or another Common–JS module system, the ConfirModal.attach function will be returned when you call require('confirmodal'). As a result, the easiest way to use ConfirModal with these loaders is as follows:

var ConfirModal = require('confirmodal'); ConfirModal({ … });

##Properties

Currently, the following properties are supported when calling ConfirModal:

title : The title to be displayed in your modal box

content : The content to be displays inside your modal box

buttons : Array of buttons displayed inside the modal box. Each button is specified as an object such that

{
	text: 'Confirm',
	event: 'confirm',
	className: 'className'
}

className : A classname to add to the modal wrapper

hideDelay : Length of time to wait before hiding/destroying the modal – useful when animating the modal

targetURL : Defaults to the target URL of the event active when ConfirModal was called (i.e. the href of a link that was clicked). This can be overridden here, or specified for events where this cannot be inherited.

##callbacks

onShow : called when the modal is appended to the DOM/shown

beforeHide : called before the modal is destroyed/hidden

confirmodal's People

Stargazers

Michael Anthony avatar

Watchers

Rolff avatar Fabz avatar Ciaran Park avatar  avatar Ashley Watson-Nolan avatar James Cloos avatar Rento avatar Michael Anthony avatar George Bardis avatar Roo Williams avatar Iqbal Khan avatar Brugos avatar  avatar Ashley Sheridan avatar Matthew Basson avatar  avatar  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.