Skip to content

myactionreplay/Mithril-Bootstrap-Modal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Mithril-Bootstrap-Modal A Mithril implementation of a Bootstrap 3 modal dialog.

##How to use After you have included a copy of Mithril and a copy of Bootstrap CSS in your document, include mithril_modal.css and mithril_modal.js

var myModal = new Modal();

var app = {
    view: function () {
        return m('div', [
            m('.btn.btn-primary', {onclick: myModal.show.bind(myModal)}, 'Click to show modal'),
            myModal.view({
                header: function () {
                    return m('h4.modal-title', 'modal title goes here');
                },
                body: function () {
                    return m('p', 'modal body goes here');
                },
                footer: function () {
                    return m('a.btn.btn-default', {
                        onclick: myModal.hide.bind(myModal)
                    }, 'Close');
                }
            })
        ]);
    }
};

m.mount(document.getElementById('view'), app);

##API

###Methods

  • Modal.prototype.show: Displays the modal instance.
  • Modal.prototype.hide: Hides the modal instance.
  • Modal.prototype.isVisible: Returns true if modal is visible, else false.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 80.0%
  • HTML 14.0%
  • CSS 6.0%