PageSourceSearch

http://www.certifiedelectronicsrecycler.com/js/main1.js

js certifiedelectronicsrecycler.com collected 2026-10-02 19:30:09 UTC 13,692 bytes, 393 lines download raw bytes

1/**
2 *
3 * @authors Your Name ([email protected])
4 * @date    2016-02-01 11:29:17
5 * @version $Id$
6 */
7$(function() {
8    init();
9});
10
11//首页样式调用初始化
12function init() {
13    slideAsyn();
14    rollSlider();
15    rollLogo();
16};
17// jQuery.support.transition
18// to verify that CSS3 transition is supported (or any of its browser-specific implementations)
19$.support.transition = (function() {
20    var thisBody = document.body || document.documentElement,
21        thisStyle = thisBody.style,
22        support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
23    return support;
24})();
25// jQuery.support.PC
26function IsPC() {
27    var userAgentInfo = navigator.userAgent;
28    var Agents = ["Android", "iPhone",
29        "SymbianOS", "Windows Phone",
30        "iPad", "iPod"
31    ];
32    var flag = true;
33    for (var v = 0; v < Agents.length; v++) {
34        if (userAgentInfo.indexOf(Agents[v]) > 0) {
35            flag = false;
36            break;
37        }
38    }
39    return flag;
40}
41(function() {
42    if (!IsPC()) {
43    //    $(".about-txt img").width(460);
44      //   $(".about-txt p").not('.last').css('paddingRight', '500px');
45    }
46})()
47
48// 各栏目切换
49function rollSlider() {
50    // console.log('rollSlider');
51    $('.wrap_list[id]').each(function() {
52        var listId = $(this).attr('id');
53        var navId = $(this).next().attr('id');
54        var listIdNum = listId.slice(-1);
55        var listIDLength = listId.length - 1;
56        var listIdName = listId.substr(0, listIDLength);
57        var lengthList = $(this).find('li').length;
58        var listWidth = $(this).find('li').width();
59        $('#' + listId).addClass('swiper-container').find('ul').addClass('swiper-wrapper').find('li').addClass('swiper-slide');
60        $('#' + listId).next('.nav_roll').addClass('pagination').detach().appendTo('#' + listId)
61        if ($('#' + listId).hasClass('type04')) {
62            if (lengthList < 5) {
63                $(this).css({
64//                    width: listWidth * lengthList
65                });
66                $(this).parent().find('.nav_roll').css({
67                    'height': 0,
68                    'display': 'none'
69                });
70            } else {
71                var listSize = $('#' + listId + ' .swiper-slide').length;
72                var listRemain = Math.abs(listSize % 4 - 4);
73                if (listRemain != 4) {
74                    for (var i = 0; i < listRemain; i++) {
75                        $('#' + listId + ' .swiper-wrapper').append('<li class="swiper-slide add"></li>')
76                    }
77                }
78                $(this).find('ul').css({
79                    width: listWidth * (lengthList + listRemain)
80                });
81                var mySwiper = new Swiper('#' + listId + '.swiper-container', {
82                    pagination: '#' + listId + ' .pagination',
83                    paginationClickable: true,
84                    paginationAsRange: false,
85                    slidesPerViewFit: false,
86                    calculateHeight: true,
87                    paginationAsRange: 4,
88                    slidesPerGroup: 4,
89                    slidesPerView: 4,
90                    simulateTouch: false
91                })
92                $('#' + listId + ' .nav_roll button').hide().filter(':nth-child(4n+1)').show();
93            }
94        } else {
95            if (lengthList < 4) {
96                $(this).css({
97                    width: listWidth * lengthList
98                });
99                $(this).parent().find('.nav_roll').css({
100                    'height': 0,
101                    'display': 'none'
102                });
103            } else {
104                var listSize = $('#' + listId + ' .swiper-slide').length;
105                var listRemain = Math.abs(listSize % 3 - 3);
106                if (listRemain != 3) {
107                    for (var i = 0; i < listRemain; i++) {
108                        $('#' + listId + ' .swiper-wrapper').append('<li class="swiper-slide add"></li>')
109                    }
110                }
111                $(this).find('ul').css({
112                    width: listWidth * (lengthList + listRemain)
113                });
114                var mySwiper = new Swiper('#' + listId + '.swiper-container', {
115                    pagination: '#' + listId + ' .pagination',
116                    paginationClickable: true,
117                    paginationAsRange: false,
118                    slidesPerViewFit: false,
119                    calculateHeight: true,
120                    paginationAsRange: 3,
121                    slidesPerGroup: 3,
122                    slidesPerView: 3,
123                    keyboardControl: true,
124                    simulateTouch: false
125                })
126                $('#' + listId + ' .nav_roll button').hide().filter(':nth-child(3n+1)').show();
127            }
128        }
129    });
130}
131// 首页大图切换
132function slideAsyn() {
133    return $("#slide").each(function() {
134        var $panel = $("#panel");
135        var window_h = $(window).height();
136        var slideLen = $panel.find("li").length;
137        var curIndex = 0;
138        var timer = null;
139        var factor = 620 / 2000;
140        var $con = $("#slide").closest(".banner");
141        var banner_h = $(window).width() > 1240 ? ($(window).width() * factor) : (1240 * factor);
142        var groupTop = banner_h;
143        var groupBottom = $(".count").offset().top;
144        $con.height(banner_h);
145        // if ($.browser.msie) {
146        //     $("#leftsead").css({
147        //         top: groupTop + 5,
148        //         marginTop: '0px'
149        //     });
150        // }
151
152        function slideSwitch(index) {
153            if (index === slideLen) {
154                index = 0;
155            } else if (index === -1) {
156                index = slideLen - 1;
157            }
158            curIndex = index;
159            var $curSlide = $("li", $panel).eq(index);
160            var $curDot = $("i", "#hd-dot").eq(index);
161            var imgUrl = $curSlide.find("img").attr("data-img");
162            if ($curSlide.data("load")) {
163                $curSlide.siblings().fadeOut("slow");
164                $curSlide.fadeIn("slow");
165                $curDot.addClass('active').siblings().removeClass('active');
166            } else {
167                var oImg = new Image();
168                oImg.onload = function() {
169                    $curSlide.find("img").attr("src", imgUrl);
170                    $curSlide.siblings().fadeOut("slow");
171                    $curSlide.fadeIn("slow");
172                    $curDot.addClass('active').siblings().removeClass('active');
173                    $curSlide.data("load", true);
174                };
175                oImg.onerror = function() {
176                    // TODO: Log Error to server
177                };
178                oImg.src = imgUrl;
179            }
180            clearTimeout(timer);
181            timer = setTimeout(function() {
182                curIndex++;
183                slideSwitch(curIndex);
184            }, 5000);
185        }
186        slideSwitch(curIndex);
187        $(this).hover(function() {
188            clearTimeout(timer);
189            event.stopPropagation();
190        }, function() {
191            timer = setTimeout(function() {
192                curIndex++;
193                slideSwitch(curIndex);
194            }, 5000);
195            event.stopPropagation();
196        });
197        // 左右指针箭头
198        $("#hd-prev").click(function() {
199            curIndex--;
200            slideSwitch(curIndex);
201        });
202
203        $("#hd-next").click(function() {
204            curIndex++;
205            slideSwitch(curIndex);
206        });
207        //圆点点击事件
208        for (var i = slideLen - 1; i >= 0; i--) {
209            if (i == (slideLen - 1)) {
210                $("#hd-dot").append("<i class='active'></i>")
211            } else {
212                $("#hd-dot").append('<i/>')
213            }
214        }
215        $("#hd-dot").find('i').click(function(event) {
216            /* Act on the event */
217            curIndex = $(this).index();
218            slideSwitch(curIndex);
219        });
220        //滚动视差
221        $(window).scroll(function() {
222                //scrollTop是浏览器滚动条的top位置,
223                // alert(groupBottom)  
224                var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
225                if (scrollTop > (groupBottom - window_h)) {
226                    // group.addClass('hs-active');
227                    countdown();
228                } else {
229                    // group.removeClass('hs-active');
230                }
231            })
232            /*缩放窗口时改变图片容器高度*/
233        $(window).resize(function() {
234            width = $(window).width() > 1240 ? $(window).width() : 1240;
235            window_h = $(window).height();
236            groupBottom = $(".count").offset().top;
237            $con.height(width * factor);
238        });
239    });
240};
241
242function rollLogo() {
243    var wrap_logo = $('.wrap_logo');
244    var lengthList = wrap_logo.find('li').length;
245    var listWidth = wrap_logo.find('li').width();
246    wrap_logo.find('ul').css({
247        width: listWidth * lengthList
248    });
249    var mySwiper = new Swiper('.wrap_logo', {
250        loop: true, //可选选项,开启循环
251        autoplay: 2000,
252        speed: 500,
253        autoplayDisableOnInteraction: false,
254        slidesPerView: 4,
255        slidesPerGroup: 1,
256        calculateHeight: true,
257        simulateTouch: false
258    });
259    $('.logo-btn-prev').click(function(event) {
260        /* Act on the event */
261        mySwiper.swipePrev();
262    });
263    $('.logo-btn-next').click(function(event) {
264        /* Act on the event */
265        mySwiper.swipeNext();
266    });
267}
268// 头部导航插件
269(function() {
270
271    var time = null;
272    var list = $("#navlist");
273    var box = $("#navbox");
274    var lista = list.find("a");
275
276    for (var i = 0, j = lista.length; i < j; i++) {
277        if (lista[i].className == "now") {
278            var olda = i;
279        }
280    }
281
282    var box_show = function(hei) {
283        box.stop().animate({
284            height: hei,
285            opacity: 1
286        }, 400);
287    }
288
289    var box_hide = function() {
290        box.stop().animate({
291            height: 0,
292            opacity: 0
293        }, 400);
294    }
295
296    lista.hover(function() {
297        lista.removeClass("now");
298        $(this).addClass("now");
299        clearTimeout(time);
300        var index = list.find("a").index($(this));
301        box.find(".cont").hide().eq(index).show();
302        var _height = box.find(".cont").eq(index).height();
303        box_show(_height)
304    }, function() {
305        time = setTimeout(function() {
306            box.find(".cont").hide();
307            box_hide();
308        }, 50);
309        lista.removeClass("now");
310        lista.eq(olda).addClass("now");
311    });
312
313    box.find(".cont").hover(function() {
314        var _index = box.find(".cont").index($(this));
315        lista.removeClass("now");
316        lista.eq(_index).addClass("now");
317        clearTimeout(time);
318        $(this).show();
319        var _height = $(this).height();
320        box_show(_height);
321    }, function() {
322        time = setTimeout(function() {
323            $(this).hide();
324            box_hide();
325        }, 50);
326        lista.removeClass("now");
327        lista.eq(olda).addClass("now");
328    });
329
330})();
331// 右侧导航插件
332
333var $hides = $(".hides");
334$("#leftsead li").hover(function() {
335    /* Stuff to do when the mouse enters the element */
336    $(this).find('.hides').show(400);
337}, function() {
338    /* Stuff to do when the mouse leaves the element */
339    $hides.hide();
340});
341$("#top_btn").click(function() {
342    if (scroll == "off") return;
343    $("html,body").animate({
344        scrollTop: 0
345    }, 350);
346});
347
348// 倒计数插件
349var only = 1; //只运行一次参数判断 
350function countdown() {
351    if (only != 0) {
352        $("#tcSlider01").find('em').each(function(index, obj) {
353            var $this = $(this);
354            var start = parseInt($this.attr('data-start')) || 0;
355            var step = parseInt($this.attr('data-step')) || 1;
356            var end = parseInt($this.attr('data-end')) || 0;
357            var time = parseInt($this.attr('data-time')) || 60;
358            var i = start;
359            setInterval(function() {
360                if (i <= end) {
361                    $this.text(i);
362                    i = i + step;
363                }
364            }, time);
365        });
366        return only = 0;
367    }
368}
369// 友情链接定位
370function localAdress(obj) {
371    var $this = $(obj);
372    var i = $('a.item').index(obj);
373    var $triangle_up = $("#triangle-up");
374    var $link_all_box = $("#link_all_box");
375    var $link_index = $(".link_index");
376    var Fleft = $this.position().left + $this.width() / 2 - 4;
377    $triangle_up.css('left', Fleft);
378    if (!$this.hasClass('on') && $this.hasClass('item')) {
379        $link_all_box.css('display', 'none');
380        $link_index.css('display', 'none').eq(i).css('display', 'block');
381        $link_all_box.fadeIn('400', function() {
382            $this.addClass('on').siblings('a').removeClass('on');
383        });
384    } else {
385        $link_all_box.fadeOut('400', function() {
386            $this.removeClass('on');
387        });
388    }
389}
390$(".footer-nav>a:not('.pdf')").click(function(event) {
391    /* Act on the event */
392    localAdress(this);
393});

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.