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

Triggering a modal without using AJAX

Discussion in 'XenForo Development Discussions' started by Jake B., Jan 15, 2016.

  1. Jake B.

    Jake B. Well-Known Member

    I have a modal that I want to display on a page, and I want it to be styled like any other modal in XenForo (member card, etc). However, I do not want the content to be loaded from another URL (so no creating a controller that outputs modal content and triggering a click on an OverlayTrigger to open this)

    I need to be able to display it using JavaScript after a specific action has been completed, what is the best way to do this?
  2. katsulynx

    katsulynx Well-Known Member

    I believe I opened a modal without using Ajax in my Post Templates addon. You may want to look through the code. I can't atm unfortunately.
  3. Daniel Hood

    Daniel Hood Well-Known Member

    XenForo.createOverlay(null, $(''
        + '<div class="xenOverlay">'
        +   '<div class="section">'
        +      '<a class="close OverlayCloser"></a>'
        +      '<h2 class="heading">Ay Jake!</h2>'
        +      '<div class="baseHtml">Sup?</div>'
        +   '</div>'
        + '</div>'
    Mike Creuzer likes this.
  4. Jake B.

    Jake B. Well-Known Member

    I'll have to give both of these a try once I get back to that project. Thanks!
  5. Jake B.

    Jake B. Well-Known Member

    Daniel Hood likes this.

Share This Page