Features

View Project On Github Just the JavaScript, Please

Usage

Trigger unmodal on a jQuery as you would with other plugins. There are a few extra options you might want to be aware of.

Include CSS

Before you start, include some CSS to style the boxes:

    <style type='text/css'>
    
      .unmodal {
        background: #000;
        opacity: .5;
        filter: alpha(opacity = 50);
      }
      
    </style>

Or, if you want to get fancy (like on this page), use CSS transitions:

    <style type='text/css'>
      .unmodal {
        background: #000;
        opacity: .5;
        filter: alpha(opacity = 50);
        -webkit-transition: opacity linear .3s;
        -moz-transition: opacity linear .3s;
        transition: opacity linear .3s;
      }
      .unmodal.unmodal-hidden {
        opacity:0;
      }
    </style>

$.unmodal

    // This will automatically black out everything except for all divs.
    // Notice that it does work even with more than one element
    $("div").unmodal(opts);

Options

    $("div").unmodal({
        hide: function() {

        }
    });

$.unmodal.clear()

The unmodal will clear by default if the user clicks on it, or presses escape. If you would like to trigger this programmatically, use $.unmodal.clear.

    $("div").unmodal();
    $.unmodal.clear();

$.unmodal.refresh()

If you ever need to trigger a refresh because of an external event, just call refresh - it is essentially a noop if there is not current unmodal.

    $("div").unmodal();
    $("div").html("Changed content");
    $.unmodal.refresh();

Demos

Content Editable Containers

The plugin will listen to input and resize events so that as you type and change the size of the region, the unmodal will resize correctly. There is a fix for IE and Firefox (which don't support the input event) using DOM Mutation Events.

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.


Grid Systems / Performance

Click on one of the geid cells and the plugin will blackout everything except all of the other cells. and is fast enough to handle dozens of elements, even in older browsers. It is smart enough to build many rectangles using non intersection rectangle detection.

1
1
1
1
1
1
1
1
1
1
1
1
4
4
4
4
8
6
6
12
1
1
1
1
1
1
1
1
1
1
1
1
4
4
4
4
8
6
6
12