• Resolved eoinkennedy

    (@eoinkennedy)


    Hi,

    Is it possible to change visibility of blocks based on a toggle on the front-end for the visitor to select?
    What I would like is to have two blocks with different content in the same area of the page, one being visible based on the time of year, but that the visitor can change to the other content using a toggle button.

    Thanks,
    Eoin

Viewing 1 replies (of 1 total)
  • Plugin Author Nick Diego

    (@ndiego)

    Hi @eoinkennedy,

    Unfortunately, this is not possible in Block Visibility. Visibility settings are triggered when the webpage is loaded, so hidden blocks are not even rendered on the page.

    That said, you could get tricky and use the Query String control. It would require a page refresh, but you could have a button that links to, for example, [current page].com/?parameter=summer.

    Then you would configure the relevant content to be visible/hidden when parameter=summer. Part of the visible content when parameter=summer could be another button that takes the user back to [current page].com/. Clicking that would refresh the page and clear the parameter value, which will hide any content set to be visible whenparameter=summer.

    Hopefully, that rough example makes sense, but it does require the page to be refreshed since the URL needs to be updated with the relevant parameters.

    Let me know if I can answer any additional questions.

    Best,
    Nick

    • This reply was modified 2 years, 7 months ago by Nick Diego.
Viewing 1 replies (of 1 total)
  • The topic ‘Visibility based on front-end toggle’ is closed to new replies.