lpdetails.js 602 B

123456789101112131415161718192021222324252627282930
  1. function show_l(name1,name2){
  2. $(name2).each(function(){
  3. if ($(this).index()>2) {
  4. $(this).hide();
  5. };
  6. });
  7. var index=1;
  8. $(name1).on('click',function(){
  9. if (index == 1) {
  10. $(this).find('span').text('收起');
  11. $(name2).each(function(){
  12. $(this).show();
  13. });
  14. $(this).addClass('on');
  15. index=2;
  16. }else if(index == 2){
  17. $(this).find('span').text('展开');
  18. $(name2).each(function(){
  19. if ($(this).index()>2) {
  20. $(this).hide();
  21. };
  22. });
  23. $(this).removeClass('on');
  24. index=1;
  25. }
  26. })
  27. }
  28. show_l('.y_lpyszsq a','.y_lpysz_table tbody tr');