From 84eca50304e4e44e3d2ae6486e83b1c4b0289efd Mon Sep 17 00:00:00 2001 From: Kyle Paulsen Date: Sun, 3 Aug 2014 19:32:31 -0700 Subject: [PATCH] Put "see it in action" links in readme and make other updates. --- README.md | 25 +++++++++++++++++-------- package.json | 2 +- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3961b66..f4b662a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # NanoModal [![Build Status](https://travis-ci.org/kylepaulsen/NanoModal.svg?branch=master)](https://travis-ci.org/kylepaulsen/NanoModal) -NanoModal is yet another modal / dialog library written in a small amount of pure JavaScript. +NanoModal is yet another modal / dialog library written in a small amount of pure JavaScript. See it in action! Features: @@ -12,15 +12,23 @@ Features: I wanted a modal library that was small, easy to use, and worked everywhere - thus NanoModal was born. When I was writing NanoModal, my main goals were: it should be tiny, fully customizable, and it should work on all major browsers (including mobile). Most modal libraries don't work well (or at all) on mobile, especially when users rotate or zoom their device while looking at a modal. I aimed to fix all these problems and make the best modal library I possibly could. +# Install + +Get the minified, or non-minified source from Github, or install via npm using the following command in your command prompt: + +``` +npm install nanomodal +``` + # Usage -Basic usage: +Basic usage: (See it in action: Example 1, Example 2) ```javascript -// usage case 1: +// example 1: var justTextModal = nanoModal("Hello World!"); justTextModal.show(); -/* usage case 2: +/* example 2: * given the html: * *
@@ -33,22 +41,23 @@ var elementModal = nanoModal(document.querySelector("#myHiddenFormDiv")); elementModal.show(); ``` -Usage with more options: +Usage with more options: (See it in action: Example 1, Example 2) ```javascript -// usage case 1: +// example 1: var modalWithNoButtons = nanoModal("Hey this is an important message!", { buttons: [] }); modalWithNoButtons.show(); -// usage case 2: +// example 2: var dialogModal = nanoModal("Are you sure you want to do this?", { overlayClose: false, // Can't close the modal by clicking on the overlay. buttons: [{ text: "I'm sure!", handler: function(modal) { // do something... - modal.close(); + alert("doing something..."); + modal.hide(); }, primary: true }, { diff --git a/package.json b/package.json index b2e47f9..01c1bf4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nanomodal", - "version": "5.0.0", + "version": "5.0.1", "description": "A small, self-contained JavaScript modal library with some extra features", "homepage": "https://github.com/kylepaulsen/NanoModal", "author": {