0

i have some problem with my jquery, i need to set up function for two kinds of list. First if elements in this list lenght 6 or less, second when it's more than 6. So i have this function but it's not working, can u help me?

if (
   $('.producer_other_articles ul').children('li').length < 7) {
   $('.producer_series_info').css('width','390px');
}
else {
   $('.producer_series_info').css('width','980px');
}
4

1 回答 1

0

尝试size()

if (
   $('.producer_other_articles li').size() < 7) {
      $('.producer_series_info').css('width','390px');
}
else {
   $('.producer_series_info').css('width','980px');
}
于 2012-10-18T15:28:27.543 回答