• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Create/Open Overlay via JavaScript

LiquidPro

Active member
#1
Does anyone know if there is a way to create an overlay and show it via javascript? I am working on some functionality that when I drag and drop something, I want it to pop up an overlay. This is the same overlay as if you added the class OverlayTrigger to a link.

Here is my temporary work around, but this is awful.

In my template...
Code:
<a href="linktodisplay" class="OverlayTrigger" id="newInstance" style="display: none;"></a>
In my javascript...
Code:
$('#newInstance').click();
The fudging that went into that makes me want to puke...
 

Fuhrmann

Well-known member
#2
You can use this:

Code:
XenForo.createOverlay($trigger, $templateHtml).load();
Just change the $trigger and the $templateHtml.