Forum Discussion

saideepak's avatar
saideepak
Contributor
6 years ago

Modal dialogue auto popup

How to do the auto pop up of modal dialogue in Lithium without click?

Atleast by using Javascript to launch the modal dialogue, how to know the modal dialogue hypertext link?

  • cike's avatar
    cike
    6 years ago

    saideepak  - The Khoros modal component always renders a link/button, even if you don't specify the parameter. In this case the default is rendered.

    But you can use CSS in your skin to hide the button, but still use the Javascript to trigger its click event.

  • saideepak,

    You can use this example code for modal dialog box.

    <#assign componentParameters = modalsupport.component.parameters.add("listSize", 10).build />
    
    <#assign modalOptions = modalsupport.options.setButtonType("secondary")
    .setTitle("Top Threads with No Reply").setSmall(false).setResizable(true)
    .setWidth(480).setMaxHeight(600).build />
    
    <@modal id="top_threads_no_replies" label="custom.top_threads_no_replies.modal" parameters=componentParameters options=modalOptions />

    Here is the documentation for how to create modal dialogs in community.

    https://community.khoros.com/t5/Developer-Knowledge-Base/Creating-Modal-Dialogs/ta-p/77986?_ga=2.205412688.1352755458.1558613566-864793710.1552666983

    • saideepak's avatar
      saideepak
      Contributor

      Parshant  Thanks for the reply But i am looking for auto pop-up i.e without click on the modal button/link. IF you know please suggest

  • saideepak  - You can include a custom modal component as described by Parshant. Afterwards you can access your community and the page, where you included the component.

    Use your browsers web development tools to inspect the source. There should be a HTML snippet for the modal, including a trigger button.

    With this information (CSS Class/ID) you can add an additional Javascript snippet, which needs to trigger the buttons click event to show the modal without any user interaction.

     

    Best regards

    Christian

    • saideepak's avatar
      saideepak
      Contributor

      Thanks cike i believe that It would work for me. Can i have a modal dialogue without any button/link? I am looking for a component/modal which automatically pops up without any button/link to end user 

      • cike's avatar
        cike
        Champion

        saideepak  - The Khoros modal component always renders a link/button, even if you don't specify the parameter. In this case the default is rendered.

        But you can use CSS in your skin to hide the button, but still use the Javascript to trigger its click event.