$(".nav li").hover(function() { $(this).find(".submenu").stop().slidetoggle(500); }); //加入收藏 function addbookmark(_this) { try { var _title = document.title; var url = document.url; if (window.sidebar) { var ua = navigator.useragent.tolowercase(); if (ua.indexof("firefox") > -1 && ua.match(/firefox\/([\d.]+)/)[1] == "23.0") { _this.setattribute("title", _title) } else { window.sidebar.addpanel(_title, url, "") } } else if (window.opera && window.print) { var __mbm = document.createelement("a"); __mbm.setattribute("rel", "sidebar"); __mbm.setattribute("href", url); __mbm.setattribute("title", _title); __mbm.click() } else if (document.all) { window.external.addfavorite(url, _title); return } else { alert("浏览器不支持该操作,尝试快捷键 ctrl + d !") } } catch (e) { alert("浏览器不支持该操作,尝试快捷键 ctrl + d !") } } $(document).ready(function () { $(".banner").hover(function () { $(this).find(".slick-prev,.slick-next").stop(true, true).fadeto("show", 0.9) }, function () { $(this).find(".slick-prev,.slick-next").fadeout() }); $('.banner').slick({ autoplay: true, autoplayspeed: 3000, dots: true }); }); var key = document.getelementbyid("key"); function searchinfo() { var base = $('head').data('base'); if (key.value) { location.href = "/products?keyword=" + key.value; } else { alert('请输入您要搜索的关键词!'); } } function searchlink(el) { var href = $(el).attr("href"); location.href = "/products?keyword=" + $(el).html(); } //窗口显示才加载 var wraptop = $(".digital").offset().top; var istrue = true; var $li=$(".digital").find("li"); $li.each(function(){ $b=$(this).find("b"); $b.each(function(){ $(this).attr("data-to",$(this).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:1000, //设置步长的时间 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); } //$(".probj").slide({titonclassname:"cur", titcell: ".pro_nav h3 a",maincell: ".pro_nr", autoplay: false,delaytime:1000, effect:"fade",vis:1 }); jquery(".spbj").slide({ maincell:".sp_c", effect:"leftloop", autoplay:true, vis:3}); // jquery(".cp_left").slide({ maincell: ".cp_c", effect: "leftloop",autoplay: true, vis:1}); jquery(".ys").slide({ titonclassname:'cur',titcell: ".ysnav ul li", maincell: ".ys_nr", autoplay: false,effect:"fade" }); jquery(".news2").slide({maincell:".news2_gd",autoplay:true,effect:"topmarquee",vis:3,intertime:50,trigger:"click"}); jquery(".lc").slide({titcell:".con li",effect:"fade",triggertime:0,titonclassname:"cur"}); jquery(".ft_cp").slide({ prevcell: ".cp_l",nextcell: ".cp_r",maincell: "ul", effect: "leftloop",autoplay: true, vis:4});