You could make use of condintional visibility with a boolean. On click of the div you trigger a microflow that changes the boolean with a refresh. In the page you set a condintional visibility based on this boolean.
A colleague of mine developed a simple Custom Widget to achieve just this. You can grab the widget .mpk here. Download that file and include it in the widgets folder in your project directory, then hit f4 in the modeler to synchronize so the modeler can see the new widget file.
Documentation for the widget can be found at the Github repo's readme.
This can be accomplished in an HTML Snippet. Let me know if this helps,
As you probably know, Container objects in Mendix are created on the page as simple Divs. So you could accomplish this using the Clickable Container widget in the appstore. This is along the lines of what Maarten suggested.
Create an entity with a boolean attribute that controls the display of the second Container. On a page, add two Containers inside of a Dataview pointing to your entity. In one container, add the Clickable Container widget and configure it to call a microflow that changes the boolean attribute to show or hide the second container.
Hope that helps,
Please find below the code you can use in a html snippet to toggle a certain element on a page based on a click on another element.
The .toggler class needs to be set on the element you want to click.
The .hiderorshow class needs to be placed on the element you want to hide/show.
Put "display:none;"" on the element you want to hide/show. This element will then by default be hidden. The .hideorshow class should be defined in your (S)CSS stylesheets and should contain "display:block;". On click of the toggler the .hideorshow class will be added to the hidden element, since it contains "display: block;", the element will appear. Of course this can also be defined the other way around.
The .toggler class does not need to be defined in your stylehsheets. It is merely for the JS to select the element.