I m un-animating a list using this code…
function unanimate_li() {
$li.filter(':last')
.animate({
height: 'hide',
opacity: 'hide'
}, 1000, function() {
unanimate_li();
});
$li = $li.not(':last');
}
I have set up the li using this code
$li = $("ol#update > li");
$li = $li.filter(':gt(4)').filter(':lt('+ size + ')');
Now when i try to do this i cannot get the 5th li(4th on zero based) to remove
It removes the sixth li
The example here
And when the second time i do the update it goes on to infinite loop
I cannot understand why
I’m not quite sure what you are trying to do here. When you call either the
animateor theunanimatefunction your callback calls the same function again and seems like it should create an infinite loop.Also, I noticed your
unanimatefunction uses$lithat is updated multiple times in the script. This became very confusing to me as to what it ultimately contained. So I modified the function to grab the currentlitags and work from there.Another thing I noticed is that you are using
:lastto find the lastliwhich I believe is also grabbing the hiddenli‘s, so either remove the hidden ones or use:visibleTry these functions: