PageSourceSearch

https://toyota-battery-kikan-recruit.com/js/cover/coverFade.js

js toyota-battery-kikan-recruit.com collected 2026-10-08 17:34:11 UTC 14,779 bytes, 358 lines download raw bytes

1(function(window, $){
2$(function(){
3    var _bEffectNone=function(){},
4    bEffectNone={},
5
6    _bEffectFade=function(){},
7    bEffectFade= {
8        wrapper: $("#coverWrap")
9        ,option: {
10            animation: false
11            ,design: ($("#coverList").length>0 ? $("#coverList").attr("class").replace("design","") : '00')
12            ,debug: false
13            ,duration: cover_duration
14            ,interval: cover_interval
15            ,length: $("#coverWrap img").length
16            ,viewWidth: $("#coverArea").width()
17            ,offset: $("#coverArea").outerWidth()
18            ,resize: false
19            ,defer: null
20            ,easing: "easeOutCubic"
21        }
22        ,position: 0
23        //初期化処理
24        ,init: function(){
25        //動的に#coverWrapに設定されるのはwidth,height,margin-leftのみ
26            if($("#coverList").length <= 0){
27                return false;
28            }			
29            
30            if(1500 < this.option.viewWidth){
31                this.option.viewWidth = $(window).width();
32            }
33            if(1500 < this.option.offset){
34                this.option.offset = $(window).width();
35            }
36            
37            //画像幅を表示エリア幅に設定
38            this.wrapper.find("a,img").width(this.option.viewWidth);			
39            //単一画像 or 複数毎でクラスを分ける、ナビの表示も切り替え
40            if(this.option.length < 2){
41                this.wrapper.find(">a").addClass("cover-single").removeAttr("style");
42                $("#coverList").find(".nav, #coverLeft, #coverRight").css({display: 'none'});
43            }else{
44                this.wrapper.find(">a").addClass("cover-multi").removeAttr("style");
45                $("#coverList").find(".nav, #coverLeft, #coverRight").removeAttr("style");
46            }
47                        
48            this.wrapper.width(this.option.viewWidth);
49
50            /* v1.6 */
51            h = parseInt($("#coverWrap-height").attr("h"));
52            if ( h == 0) {
53                h = "auto";
54            } else {
55                h = h + "px";
56            }
57            this.wrapper.height(h);
58//			this.wrapper.height("auto");
59            /* v1.6 2014.07.04 */
60
61
62            this.setImagePosition();
63            
64            //2枚以上の時はアニメーション開始
65            if(1 < this.option.length){
66                this.playAuto();
67                this.removeNaviEvent(this.option.design);
68                this.addNaviEvent(this.option.design);
69            }
70            
71            $(document).trigger("bCoverReady");
72        }
73        ,setImagePosition: function(){
74            var _this = this;
75            this.wrapper.find(">a").css({"margin-left": "0"});
76            this.wrapper.find(">a").not(":first").each(function(){
77                $(this).css({"margin-left": "-100%"});
78            });
79        }
80        //パラメータリセット
81        ,reset: function(){
82            //this.wrapper = $("#coverWrap").removeAttr('style');
83            this.wrapper = $("#coverWrap");
84            this.option.animation = false;
85            this.option.design = ($("#coverList").length>0 ? $("#coverList").attr("class").replace("design","") : '00');
86            this.option.duration = cover_duration;
87            this.option.interval = cover_interval;
88            this.option.length = $("#coverWrap img").length;
89            this.option.viewWidth = $("#coverArea").width();
90            this.option.offset = $("#coverArea").outerWidth();		
91            this.init();
92            $(window).off('resize', this.resizeHandler);
93            $(window).on('resize', {obj:this}, this.resizeHandler);
94        }
95        ,start: function(){
96            this.init();
97            $(window).off('resize', this.resizeHandler);
98            $(window).on('resize', {obj:this}, this.resizeHandler);
99            window.bEffects = this;
100            return this;
101        }
102        ,stop: function(){
103            clearTimeout(coverAutoID);
104            coverAutoID = null;
105            this.wrapper.stop(true).css({"margin-left": 0});
106        }
107        ,playAuto: function(){
108            var _this = this;
109            if(coverAutoID!=null){
110                this.stop();
111            }
112            coverAutoID = setTimeout(function(){
113                _this.debug("playAuto::setTimeout();");
114                _this.showNext();
115            }, this.option.interval);
116        }
117        ,showNext: function(){
118            var _this = this;
119            if(!_this.option.animation){
120                _this.option.animation = true;
121                _this.wrapper.find("a:last>img").animate({"opacity": 0}, {duration: _this.option.duration, easing: _this.option.easing, complete: function(){
122                        _this.position++;
123                        if(_this.option.length <= _this.position){
124                            _this.position = 0;
125                        }
126                        _this.wrapper.find(">a:last").prependTo(_this.wrapper);
127                        _this.wrapper.find(">a:first>img").css({"opacity": 1});
128                        _this.setNavigation(_this.position);
129                        _this.option.animation = false;
130                        _this.setImagePosition();						
131                        _this.playAuto();
132
133                        _this.debug("showNext::complete();");
134                        
135                        _this.debug("CURRENT="+_this.position);
136                    }
137                });
138            }
139        }
140        ,showPrev: function(){
141            var _this = this;
142            if(!_this.option.animation){
143                _this.option.animation = true;
144                //透明にする
145                _this.wrapper.find(">a:first>img").css({opacity: 0});
146                //前面に配置
147                _this.wrapper.find(">a:first").appendTo(_this.wrapper);
148                //位置セット
149                _this.setImagePosition();
150                //エフェクト開始
151                _this.wrapper.find(">a:last>img").animate({"opacity": 1}, {duration: _this.option.duration, easing: _this.option.easing, complete: function(){
152                        _this.position--;
153                        if(_this.position < 0){
154                            _this.position = (_this.option.length-1);
155                        }
156                        _this.setNavigation(_this.position);
157                        _this.option.animation = false;
158                        _this.playAuto();
159                        _this.debug("CURRENT="+_this.position);
160                    }
161                });
162            }
163        }
164        ,slideToPage: function(t){
165            var _this = this;
166            if(!_this.option.animation){
167                clearTimeout(coverAutoID);
168                //移動スライド数
169                var offset = t - this.position;
170                //1ページ移動の時
171                if(Math.abs(offset) == 1){
172                    if(offset == 1){
173                        _this.showNext();
174                    }else{
175                        _this.showPrev();
176                    }
177                }
178                //2ページ以上の時
179                else if(1 < Math.abs(offset) ){
180                    _this.multiSlide(offset);
181                }
182            }
183        }
184        ,setPosition: function(p){
185            this.position = p;
186            if(this.option.length <= this.position){
187                this.position = 0;
188            }
189            else if(this.position < 0){
190                this.position = (this.option.length-1);
191            }
192        }
193        ,multiSlide: function(offset){
194            var _this = this;
195            if(!_this.option.animation){
196                _this.option.animation = true;
197                var len = Math.abs(offset);
198
199                if(0 < offset){
200                    var target_position = (_this.option.length-1)-offset;
201
202                    //一旦表示中以外全て非表示
203                    _this.wrapper.find(">a").not(":last").find(">img").css({opacity:0});
204                    //目標位置の画像だけ表示
205                    _this.wrapper.find(">a:eq("+target_position+")>img").css({opacity:1});
206                    //エフェクト開始
207                    _this.wrapper.find("a:last>img").animate({"opacity": 0}, {duration: _this.option.duration, easing: _this.option.easing, complete: function(){
208                            //順序入れ替え
209                            for(var i = 0; i < len; i++){
210                                _this.wrapper.find(">a:last").prependTo(_this.wrapper);
211                                _this.position++;
212                            }
213                            
214                            //全て表示
215                            _this.wrapper.find(">a").not(":last").find(">img").css({opacity:1});
216                            
217                            //位置セット
218                            _this.setImagePosition();
219
220                            if(_this.option.length <= _this.position){
221                                _this.position = 0;
222                            }
223                            _this.setNavigation(_this.position);
224                            _this.option.animation = false;
225                            _this.playAuto();
226                            _this.debug("showNext::complete();");
227                            _this.debug("CURRENT="+_this.position);
228                        }
229                    });
230                }else if(offset < 0){
231                    var tmp_position = _this.position;
232                    //一旦表示中以外全て非表示
233                    $("#coverWrap").find(">a").not(":last").find(">img").css({opacity:0}
233);
234                    //順序入れ替え
235                    for(var i = 0; i < len; i++){
236                        _this.wrapper.find(">a:first").appendTo(_this.wrapper);
237                        _this.wrapper.find(">a:last>img").css({"opacity": 0});
238                        tmp_position--;
239                    }
240                    //位置セット
241                    _this.setImagePosition();
242                    _this.wrapper.find("a:last>img").animate({"opacity": 1}, {duration: _this.option.duration, easing: _this.option.easing, complete: function(){
243                            _this.wrapper.find(">a").not(":last").find(">img").css({"opacity": 1});
244                            _this.position = tmp_position;
245                            if(_this.position < 0){
246                                _this.position = (_this.option.length-1);
247                            }
248                            _this.option.animation = false;
249                            _this.setNavigation(_this.position);
250                            _this.playAuto();
251                        }
252                    });
253                }else{
254                    _this.option.animation = false;
255                }
256            }
257        }
258        ,setNavigation: function(pos){
259            $(".nav li a").removeClass("active");
260            $(".nav li a:eq("+pos+")").addClass("active");
261        }
262        ,addNaviEvent: function(ev){
263            var _this = this;
264            if(ev == "02"){
265            //丸ボタン
266                var nav = $(".nav>ol>li>a");
267                //ナビのwidthを設定
268                var navWidth = 0;
269                nav.each(function(){
270                    navWidth += $(this).outerWidth() + parseInt($(this).parent().css("marginRight").replace("px", ""))+1;
271                });
272                $(".nav").width(navWidth)
273                //位置調整
274                $(".nav").css({"margin-left": -((13*_this.option.length)/2)});
275                //インデックスをセット
276                nav.each(function(idx){
277                    $(this).data({index:idx});
278                })
279                //イベント設定
280                $(".nav>ol>li>a").on('click', {obj:_this}, _this.naviEventHandler);
281            }else if(ev == "03"){
282            //アロー
283                $("#coverLeft, #coverRight").css({display: 'block'});
284                $("#coverLeft").on("click", {obj:_this}, _this.prevEventHandler);
285                $("#coverRight").on("click", {obj:_this}, _this.nextEventHandler);
286            }
287        }
288        ,removeNaviEvent: function(ev){
289            var _this = this;
290            if(ev == "02"){
291                $(".nav>ol>li>a").off('click');
292            }else if(ev == "03"){
293                $("#coverLeft").off("click");
294                $("#coverRight").off("click");
295            }
296        }
297        ,naviEventHandler: function(e){
298            var _this = e.data.obj;
299            _this.slideToPage($(this).data("index"));
300            e.stopPropagation();
301            e.preventDefault();
302        }
303        ,prevEventHandler: function(e){
304            var _this = e.data.obj;
305            _this.showPrev();
306            e.stopPropagation();
307            e.preventDefault();
308        }
309        ,nextEventHandler: function(e){
310            var _this = e.data.obj;
311            _this.showNext();
312            e.stopPropagation();
313            e.preventDefault();
314        }
315        //windowリサイズイベント
316        ,resizeHandler: function(e){
317            var _this = e.data.obj;
318            //windowか判定(IE対策)
319            if(e.target.location){
320                clearTimeout(coverAutoID);
321                _this.reset();
322            }
323        }
324        ,debug: function(mes){
325            if(this.option.debug){
326                if($("#logger").length==0){
327                    $("body").append("<p id=\"logger\" style=\"position: absolute; background: #FFF; top:10px; left: 10px;\">"+mes+"</p>")
328                }else{
329                    $("#logger").append("<br />"+mes);
330                }
331            }
332        }
333    };
334    //フェードオブジェクト作成
335    window.bEffectFade = bEffectFade;
336    
337
338    //エフェクト無しオブジェクト作成(フェードオブジェクトを継承)
339    bEffectNone = $.extend(true, {}, bEffectFade);
340    //切り替え秒数10固定
341    bEffectNone.option.duration = 10;
342    //reset()書き換え
343    bEffectNone.reset=function(){
344        this.wrapper = $("#coverWrap");
345        this.option.animation = false;
346        this.option.design = ($("#coverList").length>0 ? $("#coverList").attr("class").replace("design","") : '00');
347        this.option.interval = cover_interval;
348        this.option.length = $("#coverWrap img").length;
349        this.option.viewWidth = $("#coverArea").width();
350        this.option.offset = $("#coverArea").outerWidth();			
351        this.init();
352        $(window).off('resize', this.resizeHandler);
353        $(window).on('resize', {obj:this}, this.resizeHandler);		
354    }
355    window.bEffectNone = bEffectNone;
356});
357
358})(window, jQuery);

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.