PageSourceSearch

https://cishefei.com/Js/Upload/accordion.js?d=20250625021434

js cishefei.com collected 2026-10-08 19:04:03 UTC 2,982 bytes, 96 lines download raw bytes

1//手风琴
2var accor=function(acc,wd,speed,isOpen,isClickOpen){
3	var $accor=acc;
4	var accorImg=$accor.find('.xg_img img');
5	var accorSet=function(){
6		var wdC;
7		var $accorLi=$accor.find('.data_col');
8		var leng=$accorLi.length;
9		var wdParent;
10		var liOWid;
11		var patt1 = new RegExp(/^\d+%$/);
12		var isPatt=patt1.test(wd);
13		var perc=0;
14		if(isPatt){
15			perc=wd.replace("%","");
16		}
17		var widSetInit=function(){
18		  wdParent=$accor.width();
19		  if(isPatt){
20			wd=parseInt(wdParent) * perc/100;
21		  }
22		  if(wdParent*0.7>wd){
23			  wdC=wd;
24		  }else{
25			  wdC=wdParent*0.7;
26		  }
27		  $accorLi.find('.xg_img').css({'width':wdC});
28		  liOWid=(wdParent-wdC-2)/(leng-1);
29		  $accorLi.css({'width':wdParent/leng});
30		  if(isOpen){
31			 $accorLi.eq(0).addClass('cur').stop(true).animate({width:wdC},speed).siblings().removeClass('cur').stop(true).animate({width:liOWid},speed); 
32		  }
33		  // setTimeout(function () {
34			 //  $accor.css({'height':$accor.height()});
35			 //  $accorLi.find('.xg_img').css({'height':$accor.height()});
36		  // }, 200);
37		}
38		widSetInit();
39		$(window).resize(function(){
40		  $accor.css({'height':'auto'});
41		  $accorLi.find('.xg_img').css({'height':'auto'});
42		  widSetInit();
43		});
44
45		if(isClickOpen){
46			$accor.addClass('accorClick');
47			$accorLi.children('a').remove();
48			$accorLi.on('click',function(){
49			   var _index = $(this).index();
50			   $(this).addClass('cur').stop(true).animate({width:wdC},speed).siblings().removeClass('cur').stop(true).animate({width:liOWid},speed);
51			})
52		}else{
53			$accor.addClass('accorNoClick');
54			$accorLi.hover(function(){
55			 var _index = $(this).index();
56			 $(this).addClass('cur').stop(true).animate({width:wdC},speed).siblings().removeClass('cur').stop(true).animate({width:liOWid},speed);
57			},function(){
58			  if(!isOpen){
59				  $accorLi.stop(true).animate({'width':wdParent/leng},speed).removeClass('cur');
60			  }
61			})
62		}
63	}
64	// 判断图片加载的函数
65    var accrIsImgLoad = function (_obj) {
66        if (_obj.height() === 0) {
67            var t_img;
68            t_img = setInterval(function () {
69                clearInterval(t_img);
70                accrIsImgLoad(_obj);
71            }, 10);
72        } else {
73            accorSet(_obj);
74        }
75    }
76
77    for (var i = 0; i < accorImg.length; i++) {
78        var accrImg = $(accorImg[i]);
79        var newImg = new Image;
80        newImg.index = i;
81        accrIsImgLoad($(accorImg[i]));
82        newImg.src = accrImg.attr('src');
83    }
84}
85
86
87
88        $(function(){
89        		var device = page.currentDevice();
90        		if (device == 1) {
91        			accor($('#i995537c7e6b32f9a'),'50%',500,true,false);  //参数1:Dom节点,参数2:展开图宽度(值可正数像素值或百分比)、参数3:速度(ms)、参数4:初始是否展开(是true,否false)、参数5:是否点击展开(是true,否false)
92
93        		}     
94        });
95
96

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.