$(document).ready(function () { $('.banner_m').slick({ autoplay: true, autoplayspeed: 4000, dots: true }); }); jquery(".pro_nav").slide({titcell:"li",titonclassname:"cur"}); jquery(".six").slide({titcell:"dl",titonclassname:"cur"}); jquery(".super").slide({titcell:".sup_nav ul li",maincell:".sup_m",effect:"fade",autoplay:false,delaytime:700}); jquery(".partner").slide({maincell:".par_qie ul",autoplay:true,effect:"leftmarquee",vis:6,intertime:30,trigger:"click"}); jquery(".news").slide({titcell:".news_t ul li",maincell:".news_m",effect:"fade",autoplay:false,delaytime:700}); $('#parentiframe').on('click', function(){ layer.open({ type: 2, title: false, area: ['960px', '540px'], shade: 0.8, closebtn: 1, shadeclose: true, content: 'images/video.mp4' }); }); /* 内层图片无缝滚动 */ jquery(".photo .photo_m").slide({ maincell:".photo_qie ul",vis:5,nextcell:".cp_lico",prevcell:".cp_rico",effect:"leftloop",autoplay:false}); /* 外层tab切换 */ jquery(".photo").slide({titcell:".photo_t li",maincell:".photo_con"}); if (!(/msie [6|7|8|9]/i.test(navigator.useragent))){ new wow().init(); }; //窗口显示才加载 var wraptop = $(".digital").offset().top; var istrue = true; var $li=$(".digital").find("li"); $li.each(function(){ $(this).find("b").attr("data-to",$(this).find("b").text()) }) $(window).on("scroll", function() { var s = $(window).scrolltop(); if (s > wraptop - 500 && istrue) { $(".timer").each(count); function count(a) { var b = $(this); a = $.extend({}, a || {}, b.data("counttooptions") || {}); b.countto(a) }; istrue = false; }; }) //设置计数 $.fn.countto = function (options) { options = options || {}; return $(this).each(function () { //当前元素的选项 var settings = $.extend({}, $.fn.countto.defaults, { from: $(this).data('from'), to: $(this).data('to'), speed: $(this).data('speed'), refreshinterval: $(this).data('refresh-interval'), decimals: $(this).data('decimals') }, options); //更新值 var loops = math.ceil(settings.speed / settings.refreshinterval), increment = (settings.to - settings.from) / loops; //更改应用和变量 var self = this, $self = $(this), loopcount = 0, value = settings.from, data = $self.data('countto') || {}; $self.data('countto', data); //如果有间断,找到并清除 if (data.interval) { clearinterval(data.interval); }; data.interval = setinterval(updatetimer, settings.refreshinterval); //初始化起始值 render(value); function updatetimer() { value += increment; loopcount++; render(value); if (typeof(settings.onupdate) == 'function') { settings.onupdate.call(self, value); } if (loopcount >= loops) { //移出间隔 $self.removedata('countto'); clearinterval(data.interval); value = settings.to; if (typeof(settings.oncomplete) == 'function') { settings.oncomplete.call(self, value); } } } function render(value) { var formattedvalue = settings.formatter.call(self, value, settings); $self.html(formattedvalue); } }); }; $.fn.countto.defaults={ from:0, //数字开始的值 to:0, //数字结束的值 speed:3000, //设置步长的时间 refreshinterval:100, //隔间值 decimals:0, //显示小位数 formatter: formatter, //渲染之前格式化 onupdate:null, //每次更新前的回调方法 oncomplete:null //完成更新的回调方法 }; function formatter(value, settings){ return value.tofixed(settings.decimals); } //自定义格式 $('#count-number').data('counttooptions',{ formmatter:function(value, options){ return value.tofixed(options.decimals).replace(/\b(?=(?:\d{3})+(?!\d))/g, ','); } }); //定时器 $('.timer').each(count); function count(options){ var $this=$(this); options=$.extend({}, options||{}, $this.data('counttooptions')||{}); $this.countto(options); } $(function() { var time; //var winheight = top.window.document.body.clientheight || $(window.parent).height(); $('.client-2').css({ 'margintop': -($('.client-2').height() / 2) }); //返回顶部 $(window).scroll(function() { var scrolltop = document.documentelement.scrolltop || window.pageyoffset || document.body.scrolltop; var eltop = $("#client-2").find(".my-kefu-ftop"); if (scrolltop > 0) { eltop.show(); } else { eltop.hide(); } }); $("#client-2").find(".my-kefu-ftop").click(function() { var scrolltop = document.documentelement.scrolltop || window.pageyoffset || document.body.scrolltop; if (scrolltop > 0) { $("html,body").animate({ scrolltop: 0 }, "slow"); } }); });