Issues with a script earlier discussed. Here
Basically my html is not behaving the way i want it to.
Clicking: All - Display all containers
<div class="slide">
Action Adventure - Display
<div class="slide" title="Action Adventure">
Drama - Display
<div class="slide" title="Drama">
And so on...
FIXED On initial load, load all containers only currently works on first load. After I click anather genre, then go back to 'All' it seems to behave strangly only displaying every other
This issue remains Then, i noticed that after initial load, clicking down the list, it is displaying the next container down instead of the one with identical title and text. I think it has to do with the index(); but im not entirely sure. I need to get this dang thing working right.
Thanks guys!
ps, there is other jquery to hide the the nth-child. just ignore it.
Thanks for all the help!
One last thing I need assistance with is hide all the first-child ul's when all are visible. Except the very first one under Action-adventure.
This doesn't completely answer your question, but be sure to stop queued animations before you do something like fade out:
otherwise, clicking on a button a couple of times will cause the animation to run over and over
Here:
Working DEMO
demo with comments
Here we are using the
.index()
number of a clickedli
- to open a TAB whose:eq()
equals this.index()
.Look at this tables: Before you had this:
And each
li
was opening nicely his respective tab.slide
.But than you decided to add an element
.all
that will open ALL your tabs, But now you have this:As you can see
.all
has not his specific 'brother' tab to open. It just has to OPEN ALL TABS!But, adding this 'extra'
li
element you have 'moved' the index numbers of the otherli
elemnts by 1 up.Now clicking the
li
Drama , having now the index 3 it will open the TAB that has the same index. But that's the TAB containing Documentary movies! as it still has the index number 3!To fix that new issue you have to search for a tab that has THIS index number but -1.
( Drama index(3)-1 = open Drama tab index(2) )
Having that in mind you just have to
.fadeOut()
all previously opened tabs using the jQuery:visible
selector. Ex:That will prevent interfering your script with all other
.slide
.And here is your script:
You can use also:
$('.slide').eq(i).fadeIn(400);
looks prettier! :)