Creating Reveal: jQuery Modal

Reveal is the latest modal creation of Zurb which is based on jQuery. It is lightweight, simple to use, cross-browser accessible and simply works great.

Click on the image to download the zip file.

It has three basic steps:

Step 1:
Attach needed files

/* Attach the Reveal CSS */
/* jQuery needs to be attached */
 /* Then just attach the Reveal plugin */ 

code hosted by snipt.net

Step 2:
Modal Markup

Modal Title

Any content could go in here.

×
code hosted by snipt.net

Step 3:
Attaching Handler

Click Me For A Modal

OR

/* Programmatic Launching Of Reveal */
<script type="text/javascript">
$(document).ready(function() {
 $('#myButton').click(function(e) {
 e.preventDefault();
 $('#myModal').reveal();
 });
});
</script>

OPTIONS:

$('#myModal').reveal({
 animation: 'fadeAndPop',                   //fade, fadeAndPop, none
 animationspeed: 300,                       //how fast animtions are
 closeonbackgroundclick: true,              //if you click background will modal close?
 dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
});

With default values:

<a href="#" data-reveal-id="myModal" data-animation="fadeAndPop" data-animationspeed="300" data-closeonbackgroundclick="true" data-dismissmodalclass="close-reveal-modal">Click for a modal</a> 


Incoming search terms for the article:

Related Posts

Stellar.js Parallax Scrolling Plugin

jQuery-Menu-Aim

Spice Up Your Website with Spritely

360 Degrees Product View: jQuery Plugin for Image Rotation