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

Trigger an overlay via javascript

Jake B.

Well-known member
#1
I'm needing to trigger an overlay using javascript. Currently I have a button doing this using
Code:
<a href="{xen:link link}" class="OverlayTrigger">
However, I also need to be able to open it on a specific keypress, but am unable to find a usable function to open the overlay by passing the URL to it.

Perhaps @Mike could be of assistance, since I assume this was written by you.

Thanks,

Jake
 

Chris D

XenForo developer
Staff member
#2
This isn't totally right and will need some improvements but at a basic level:

Code:
$('.OverlayTrigger').click();
So if you can get a JS event to trigger that, that's the cheaty, hacky way.

For something more robust, look at what triggers the Create Album overlay to load on the Media Add form in the Gallery.
 

Jake B.

Well-known member
#3
This isn't totally right and will need some improvements but at a basic level:

Code:
$('.OverlayTrigger').click();
So if you can get a JS event to trigger that, that's the cheaty, hacky way.

For something more robust, look at what triggers the Create Album overlay to load on the Media Add form in the Gallery.
That worked, thanks!