Auto load overlay

  • Thread starter Thread starter Syndol
  • Start date Start date
S

Syndol

Guest
Hi, I am auto loading an overlay upon entering a page.
I have registered the link and then call click() upon it.
This works but it seems to call this function multiple times causing the overlay to flicker.

So my question is:
What is the proper way to auto load an overlay? :)

Thank you.
 
What about call click() and set a flag so your script won't call click() a second time?
Or better yet, you can extend XenForo_OverlayTrigger and call show() as soon as in __construct().
 
Played around with it and got an overlay to show on load of a xf page using this....

given your <a> with the class of: OverlayTigger also has an id of: IDofClicker

HTML:
<script>
  $(function(){
        $('#IDofClicker').trigger('click');
  });
</script>
it's not pretty but i wasn't trying to style it, just wanted to see if it would click the overlay link on doc ready (is that the term for it?) and it does.
overlay.webp
 
When you find what is up there let me know...all I ever see is leaves :)

I realized now that I could have made empty <a class="OverlayTrigger" id="IdofClicker"></a> that would open the overlay on page loads and yet not display anything on the page calling the overlay.
 
Guys I found this thread after someone asked me basically the same thing. We'd already thought of getting jQuery to click the link but the objective was to have no link displayed on screen. It's worth noting that XenForo Resource Manager 1.1.0 triggers the click function on page load after a resource has been added to pop up the Edit Icon overlay. This isn't an issue because that link is already displayed on-screen anyway.

So I looked into the functions in xenforo.js a little bit closer and it really isn't much more difficult than this:

Code:
            this.$trigger = { href : 'http://url-to-open-in-overlay.com' };
            this.$options = {};

            this.OverlayLoader = new XenForo.OverlayLoader($(this.$trigger), false, this.$options);
            this.OverlayLoader.load();

You can of course analyse the code a little bit further to work out other parameters you can pass through to the OverlayLoader but as it stands the code above wrapped in an appropriate function should launch the specified overlay without user intervention and without any visual triggers.
 
Top Bottom