Trigger an overlay via JS

Dasfaust

Member
How would one go about triggering an overlay with Javascript? I could only find one post on this subject, and this is what I've got so far:
HTML:
var $trigger = window.onload;
var $templateHtml = "test";
XenForo.createOverlay($trigger, $templateHtml).load();
But I'm getting this error:
Code:
Uncaught TypeError: Cannot call method 'refresh' of null xenforo.js:191
    c.extend.activate xenforo.js:191
    jQuery.fn.extend.xfActivate xenforo.js:177
    c.extend.createOverlay xenforo.js:199
    (anonymous function)

Am I going about this right?
 
Top Bottom