Modal box
This example shows the modal widget in action, in various ways.
You should note that the modal box is largely unstyled, to remain flexible for your needs.
Example 1: a button for showing the modal box
Standard modal box
Ajax modal box
Flash modal box
Image modal box
iFrame with custom template
Big long select to demonstrate IE6 modal boxes appear above the selects
demo_modal.htm
<style>
.iframeButton { width: 220px; }
</style>
<p>
<button id ="modal1" type ="button" class ="iframeButton" > Standard modal box</button>
</p>
<p>
<button id ="modal2" type ="button" class ="iframeButton" > Ajax modal box</button>
</p>
<p>
<button id ="modal3" type ="button" class ="iframeButton" > Flash modal box</button>
</p>
<p>
<button id ="modal4" type ="button" class ="iframeButton" > Image modal box</button>
</p>
<p>
<button id ="modal5" type ="button" class ="iframeButton" > iFrame with custom template</button>
</p>
<select style ="width: 800px" >
<option> Big long select to demonstrate IE6 modal boxes appear above the selects</option>
</select>
<br /> <br />
demo_modal.js pax.load .onloaded ( function ( ) {
pax.event .bind ( pax.$( 'modal1' ) , 'click' , function ( ) {
pax.widget .modal .init ( {
message: "This is a message with buttons in the footer" ,
footerMessage: "" +
" <button type='button' onclick='pax.widget.modal.hide();alert(\" You clicked Cancel\" );'>Cancel</button>" +
" <button type='button' onclick='pax.widget.modal.hide();alert(\" You clicked OK\" );'>OK</button>"
} ) ;
} ) ;
pax.event .bind ( pax.$( 'modal2' ) , 'click' , function ( ) {
// Ajax
pax.widget .modal .init ( {
url: "../examples/demo_modal_ajax.htm" ,
contentDisplay: 'block' ,
width: 800 ,
height: 400
} ) ;
} ) ;
pax.event .bind ( pax.$( 'modal3' ) , 'click' , function ( ) {
// Flash
pax.widget .modal .init ( {
width: 504 ,
height: 355 ,
message: '<object height="355" width="504"><param name="movie" value="http://www.youtube.com/v/XtBY7_3gj6o&rel=1"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/XtBY7_3gj6o&rel=1" type="application/x-shockwave-flash" wmode="transparent" height="355" width="504"></object>' ,
footerMessage: 'You can use any ordinary flash object you like!'
} ) ;
} ) ;
pax.event .bind ( pax.$( 'modal4' ) , 'click' , function ( ) {
// Image
pax.widget .modal .init ( {
message: '<img src="../examples/demo_modal_image1.jpg" style="width: 400px; height: 300px"/>' ,
footerMessage: 'It\' s Mooodal!' ,
width: 400 ,
height: 300
} ) ;
} ) ;
// iFrame with custom template that uses the message parameter.
pax.event .bind ( pax.$( 'modal5' ) , 'click' , function ( ) {
pax.widget .modal .init ( {
src: "../" ,
message: "Showing paxjs.com!" ,
//width: 416,
width: 800 ,
height: 400 ,
template:
"<div id='templatePaxModalBox'>" +
" <div id='templatePaxModalBoxFooter'>" +
" <a href='javascript:pax.widget.modal.hide();'>Close this</a> [:= message :]" +
" </div>" +
" <div id='templatePaxModalBoxContent'>[:= content :]</div>" +
"</div>"
} ) ;
} ) ;
} ) ;