jquery.fn.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * Created by Administrator on 2016/10/22.
  3. */
  4. var isopen = true;
  5. var main = {
  6. slideTabcons: function(){
  7. $('.tabcontent').slideToggle(200);
  8. if(isopen == true){
  9. $('#slideBtn').html('展 开 <span>&lt;</span>');
  10. isopen = false;
  11. return;
  12. }
  13. if(isopen == false){
  14. $('#slideBtn').html('收 起 <span>&gt;</span>');
  15. isopen = true;
  16. return;
  17. }
  18. },
  19. tab: function(){
  20. $('.tabtitle a').each(function(index,element){
  21. $(this).click(function(){
  22. $(this).addClass('active').siblings('a').removeClass('active');
  23. $('.tabwrap').eq(index).show().siblings('.tabwrap').hide();
  24. $('.tabcontent').slideDown(200);
  25. $('#slideBtn').html('收 起 <span>&gt;</span>');
  26. isopen = true;
  27. });
  28. });
  29. }
  30. };
  31. $(function(){
  32. main.tab();
  33. $('#slideBtn').off().on('click',main.slideTabcons);
  34. $('.showDetail').each(function(){
  35. $(this).on('click',function(){
  36. $(this).toggleClass('isview');
  37. $(this).parents('.itemWrap').find('.subItembox').slideToggle(200);
  38. });
  39. });
  40. //$('.newslist ul li:odd').css('float','right');
  41. $('.newslist ul').each(function(index){
  42. if(index %2 == 1) {
  43. $(this).css({'float':'right'});
  44. }
  45. var _this = $(this).find('li');
  46. _this.each(function(i){
  47. if(i%5 ==4) {
  48. $(this).after('<div class="appendline"></div>');
  49. }
  50. });
  51. });
  52. $('.tabtitle2 a').each(function(index){
  53. $(this).click(function(){
  54. $(this).addClass('active').siblings('a').removeClass('active');
  55. $('.tabcont').eq(index).show().siblings('.tabcont').hide();
  56. });
  57. });
  58. $('.nav ul li a').each(function(){
  59. var src = $(this).find('img').attr('src');
  60. if($(this).hasClass('on')){
  61. $(this).find('img').attr('src',src.substring(0,7)+'h'+src.substring(7));
  62. }
  63. $(this).hover(function(){
  64. $(this).find('img').attr('src',src.substring(0,7)+'h'+src.substring(7));
  65. },function(){
  66. $(this).find('img').attr('src',src);
  67. });
  68. });
  69. $('.infomationlist li').each(function(){
  70. var _this = $(this);
  71. _this.find('input').blur(function(){
  72. _this.find('img').hide();
  73. $(this).attr('disabled','disabled').addClass('disabled');
  74. });
  75. $(this).hover(function(){
  76. //$(this).find('input').removeClass('disabled').attr('disabled','false');
  77. $(this).find('img').show();
  78. },function(){
  79. $(this).find('img').hide();
  80. });
  81. });
  82. $('.edit').each(function(){
  83. $(this).off().on('click',function(){
  84. $(this).parents('li:first').find('input').removeClass('disabled').attr('disabled',false);
  85. });
  86. });
  87. });