Well, thatβs a little hard to explain, and therefore a little hard to find, so please forgive me if this were asked earlier. I will explain this in detail.
I have a webpage with a different number of icons. When a user clicks on an icon, he should display the content associated with this icon in a DIV
. Here, where it gets complicated. No matter which icon the user clicks, the content must be loaded into the same DIV
. However, only the content for one icon should be visible at a time. Therefore, if the content for "A" is loaded and the user presses "B", the content for "A" should disappear and be replaced with "B", the fade, the same with "C", "D", ", etc. . (probably up to a maximum of 5.) The content can vary greatly in size, so the content DIV
for the content must animate its height in order to adapt to the current content.
Where I am stuck is an animation. I figured out how to hide and show other content, basically by setting display: none;
"and display: block;
to different sections of the content based on where the user clicks, but I can't figure out how to get any animation.
I am open to using a pre-created script, but I remember that the icons and the content area are in separate shells, so the regular jQuery script or accordion script tab will not work.
Here is my hunch:
$(document).ready(function() { $(".heading").click(function(event) {
CSS for .hidden
and .active
:
.hidden { display: none; } .hidden.active{ display: block !important; }
If necessary, everything can be changed, but not the fact that they are in separate shells.
Thanks.