So I've been googling around, but just havn't found any good solution for this layout yet.
What Im trying to do is like a gallery. First thumbs, then a large below the clicked thumb.
The problem is to separate different events.
- A click with no visible div. (Slide down selected div)
- A click with a visible div. (Transition to new div. Hide old, then show the new one or something)
- A click with an already selected div. (Slide up selected div)
Been struggling around with different solutions, but either it's glitchy or sometimes it doesn't react to clicks at first.
Basic structure so far:
<ul>
<li id="case1">Thumb1</li>
<li id="case2">Thumb2</li>
<li id="case3">Thumb3</li>
</ul>
<div id="case1box">Content</div>
<div id="case2box">Content</div>
<div id="case3box">Content</div>
Then repeating that snippet. Any better solution, as it's UL(3xLI) then DIV, UL(3xLI) then DIV?
Any thoughts on the toggling and how to solve it?
Default state:
When clicked:
I'll respond to your behavior one by one and in pseudo code. i'll assume you know enough jquery until further notice :)
A click with no visible div. (Slide down selected div) - easy, put a class and id on your lis. then bind the toggle function to that class:
that takes care of item 1 and 3 already(A click with an already selected div. (Slide up selected div)
as for item 2: A click with a visible div. (Transition to new div. Hide old, then show the new one or something)
have a variable that keeps your last selected div and a function that closes open divs(the ones with the larger image).
Hope that points you to the right direction