tags:

views:

13

answers:

1

I have a function where I want the speed of the slideToggle to be dependent on how many children/list items are in the list "$(this).prevAll('.list_category:first')". Can someone tell me where I'm being stupid?

$(".expand").click(function() {
var iNum = $(this).prevAll('.list_category:first').length();
var tNum = iNum*100;
    $(this).prevAll('.list_category:first').slideToggle(tNum, function(){
+2  A: 

Remove the parentheses from length():

var iNum = $(this).prevAll('.list_category:first').length;

Or you can use .size()

var iNum = $(this).prevAll('.list_category:first').size();
John Rasch