Thursday, 29 October 2009 09:34

As part of a recent project, I needed to open a modal window using Javascript. Here's how I did it.

First, I made sure the modal behavior was loaded:

JHTML::_('behavior.modal');

Then, in my Javascript, I created a new element to house all of my dynamic content (this could also be a hidden div, if needed). Once I had that, all I had to do was pass the MooTools reference of that object to SqueezeBox, and open.

var newElem = new Element( 'div' ).setText( 'demo' );
SqueezeBox.setContent( 'adopt', newElem );

Now, had I wanted to open an external resource with an iframe handler, I could use the following:

SqueezeBox.setContent( 'iframe', 'http://jeffchannell.com' );
Last Updated on Monday, 07 December 2009 12:44
 
Comments (1)
1 Thursday, 04 February 2010 15:11
Fronky
Thanks a lot!!
Simple and working

Add your comment

Your name:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:

Featured Extensions

$1.00
FREE
$10.00
$5.00
You Save: $5.00
$5.00
Joomla Extensions