function scroll(fn) { var beforeScrollTop = document.body.scrollTop || document.documentElement.scrollTop, fn = fn || function() {}; window.addEventListener("scroll", function() { var afterScrollTop = document.body.scrollTop || document.documentElement.scrollTop, delta = afterScrollTop - beforeScrollTop; if(delta == 0) return false; fn(delta > 0 ? "down" : "up"); beforeScrollTop = afterScrollTop; }, false); } //鍒ゆ柇瀛楃鏄惁涓虹┖鐨勬柟娉 function isEmpty(obj){ if(typeof obj == "undefined" || obj == null || obj == ""){ return true; }else{ return false; } } function getQueryString(name) { var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null; } function open53kf(){ var iWidth=800; //寮瑰嚭绐楀彛鐨勫搴? var iHeight=600; //寮瑰嚭绐楀彛鐨勯珮搴? //鑾峰緱绐楀彛鐨勫瀭鐩翠綅缃 var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //鑾峰緱绐楀彛鐨勬按骞充綅缃 var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; var params = 'scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=800,height=600,left='+iLeft+',top='+iTop; open('https://tb.53kf.com/code/client/10129344/1','53kf',params) } $(function () { $('.kflink').click(function(){ window.open('http://www.top-iot.com/list-42-1.html'); //open53kf(); }); /*閿氱偣鍔ㄦ晥*/ $('a[href*="#"],area[href*="#"]').click(function() { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); if ($target.length) { var targetOffset = $target.offset().top; $('html,body').animate({ scrollTop: targetOffset }, 1000); return false; } } }); var windoww = $(window).width(); $('.sp_nav,#nav-close').click(function () { $('.sp_nav').toggleClass('sp_nav_se'); $('.sjj_nav').toggleClass('nav_show'); }); $('.sjj_nav ul li i').click(function () { $(this).parent().children('ul').slideToggle().parent().siblings().children('ul').slideUp(); $(this).toggleClass('sjj_nav_i_se'); $(this).parent().siblings().find('i').removeClass('sjj_nav_i_se'); }); $('.sp_nav_xjb').html(' '); var e = $('#smenu'); var li = e.find("li"); var len = li.length; if(len * li.width() > e.width()){ var swiper = new Swiper('#smenu', { freeMode: true, slidesPerView: 'auto', freeModeSticky: true, //spaceBetween: 30, //pagination: { //el: '.swiper-pagination', //clickable: true, //}, }) var index = e.find('.active').index(); if(index > 0 && index + 1 != len){ index-- } index && swiper.slideTo(index); }else{ //e.addClass('dbl'); e.parent().addClass('dbl'); } var elems=$(".animated"); elems.each(function(i,a) { if ($(a).offset().top >= $(window).scrollTop() && $(a).offset().top < ($(window).scrollTop() + $(window).height())) { var animated=$(this).attr('data-animated'); $(this).addClass(animated); } }); scroll(function(direction) { if(direction=="down"){ elems.each(function(i,a) { if ($(a).offset().top >= $(window).scrollTop() && $(a).offset().top < ($(window).scrollTop() + $(window).height())) { //$(this).addClass('fadeInUp'); var animated=$(this).attr('data-animated'); $(this).addClass(animated); } }); } }); var contentElems=$(".details_warp>*"); contentElems.each(function(i,a) { if ($(a).offset().top >= $(window).scrollTop() && $(a).offset().top < ($(window).scrollTop() + $(window).height())) { if(i%2){ $(this).addClass("animated").addClass("fadeIn"); }else{ $(this).addClass("animated").addClass("fadeIn"); }} }); scroll(function(direction) { if(direction=="down"){ contentElems.each(function(i,a) { if ($(a).offset().top >= $(window).scrollTop() && $(a).offset().top < ($(window).scrollTop() + $(window).height())) { if(i%2){ $(this).addClass("animated").addClass("fadeIn"); }else{ $(this).addClass("animated").addClass("fadeIn"); }} }); } }); /*棣栭〉骞冲彴鎸夐挳鎮仠鏁堟灉 */ $(".cloud_list li").hover(function(){ console.log('s'); var obj= $(this).find('.btn').first(); $(".cloud_list .btn").removeClass('act'); obj.addClass("act"); },function(){ //$(this).removeClass("act"); }); }); /* const doct = window.document.documentElement; const el = document.querySelectorAll(".animated"); window.addEventListener("scroll", () => { el.forEach((v, i) => { alert(i); if (v.offsetTop > doct.scrollTop && v.offsetTop < doct.clientHeight + doct.scrollTop) { v.addClass('fadeInUp'); // v.style.color = "red";// 缁欏彲瑙嗗尯鍩熷厓绱犳坊鍔犵孩鑹 } }); });*/