Skip to main content

Mootools Epiosde 2

Back to Article

Modal Box Example:

Click Here for a modal box

Here is the content

HTML:

<a href="#" id="example-modal-box-trigger">Click Here for a modal box</a>
<div id="example-modal-box-content" class="hide">
    Here is the content
</div>

Javascript:

window.addEvent('domready', function(){
    //Get the trigger and content for the modal box
    var trigger = $('example-modal-box-trigger');
    var content = $('example-modal-box-content');

    //When the link object is clicked, create the box
    trigger.addEvent('click', function(e){
            //create the modal box
           var modal = new Modalbox({
               'ismodal':true,
                'width':200,
                'height':300,
                'title':'My Modal Box',
                'closetext':'Close',
                'position':{
                    'screen':['middle','center']
               },
               'adopt': $(content)
        });

       //stop the event from going to the link
        e.stop();
    });
});

 
You will need to download the latest Adobe Flash Player to use all features of this page.
Details View
No items have been added to this area.

Are you sure you want to steal this reservation?


Viewed 422 times