jquery(document).ready(function () { var qcloud = {}; $('[_t_nav]').hover(function () { var _nav = $(this).attr('_t_nav'); cleartimeout(qcloud[ _nav + '_timer' ]); qcloud[ _nav + '_timer' ] = settimeout(function () { $('[_t_nav]').each(function () { $(this)[ _nav == $(this).attr('_t_nav') ? 'addclass' : 'removeclass' ]('cur'); }); $('#' + _nav).stop(true, true).slidedown(200); }, 150); }, function () { var _nav = $(this).attr('_t_nav'); cleartimeout(qcloud[ _nav + '_timer' ]); qcloud[ _nav + '_timer' ] = settimeout(function () { $('[_t_nav]').removeclass('cur'); $('#' + _nav).stop(true, true).slideup(200); }, 150); }); }); /* * 视频播放 * speed:速度,300ms */ $.extend({ isempty: function (str) { if (str === undefined || str == null) { return true; } str = $.trim(str); if (str == "") { return true; } return false; }, //获得url参数 get: function (param) { var url = document.url; var paramlist = url.split("?")[1]; if (paramlist) { var arr = paramlist.split("&"); for (var i = 0; i < arr.length; i++) { var arr2 = arr[i].split("="); if (arr2[0] == param) { return arr2[1]; } } } return false; }, }); $.fn.videoplay = function (options) { var defaults = { speed: 300, src: "" } var options = $.extend(defaults, options); this.each(function () { if ($.isempty(options.src)) { return; } var _bj = $('
').appendto("body"); var _pop = $('
').appendto("body"); //var _close=$('').appendto("body"); _pop.append(''); //_pop.append(''); _bj.fadeto(options.speed, 0.9); _pop.slidedown(options.speed); $(".popvideoclose").on("click", function () { _bj.fadeto(options.speed, 0); _pop.slideup(options.speed, function () { _bj.remove(); _pop.remove(); //_close.remove(); }); }); }); }; $(document).on("click", ".videoplay", function () { var _this = $(this); var _src = _this.attr("href"); _this.videoplay({src: _src}); return false; }); $(function(){ $(".header .nav li").hover(function() { $(this).children('.sub-box').stop().slidedown(); }, function() { $(this).children('.sub-box').stop().slideup(); }); $('.header .so-btn').click(function(event) { /* act on the event */ $('.header .so-box').stop().slidetoggle(); }); $('.header .so-box .close').click(function(event) { /* act on the event */ $('.header .so-box').stop().slideup(); }); // mobile导航 $('.menubtn').click(function(e) { $(this).toggleclass('on'); e.stoppropagation(); if($(this).hasclass('on')){ $('.header .so-box').slideup(); $('#aside').slidedown(); }else{ $('#aside').slideup(); } }); $('#aside').click(function(e) { e.stoppropagation(); }); $(document).on('click',function(){ $('.menubtn').removeclass('on'); $('#aside').slideup(); }); //手机二级菜单 $('.menu li > a').click(function(){ var sub = $(this).parents('li').find('.sub-nav'); if( !sub.length > 0){ return true; } if(sub.is(':visible')){ sub.slideup(); $(this).parents('.sub-nav').removeclass('open'); }else{ $('.sub-nav').slideup(); sub.slidedown(); $('.menu li').removeclass('open'); $(this).parents('li').addclass('open'); } return false; }) // 底部导航 function myfnav(){ var _winw = $(window).width(); $('.fd-t dl').removeclass('open'); if( _winw > 999){ $('.fd-t dd').show(); }else{ $('.fd-t dd').hide(); } } $('.ft-t dt').click(function(){ var _winw = $(window).width(); if( _winw < 1024 ){ var _pare = $(this).parent('dl'); _pare.siblings('dl').removeclass('open'); _pare.siblings('dl').find('dd').stop().slideup(); _pare.toggleclass('open'); if( _pare.hasclass('open') ){ _pare.find('dd').stop().slidedown(); }else{ _pare.find('dd').stop().slideup(); } } }); // 选项卡 鼠标点击切换 $(".tab_click li").click(function(){ var tab=$(this).parent(".tab_click"); var con=tab.attr("id"); var on=tab.find("li").index(this); $(this).addclass('on').siblings(tab.find("li")).removeclass('on'); $(con).eq(on).show().siblings(con).hide(); }); // 选项卡 鼠标经过切换 $(".tab li").mousemove(function(){ var tab=$(this).parent(".tab"); var con=tab.attr("id"); var on=tab.find("li").index(this); $(this).addclass('on').siblings(tab.find("li")).removeclass('on'); $(con).eq(on).show().siblings(con).hide(); }); $('.pagenavph').find('.now').click(function(){ $('.pagenavph').find('.list').fadetoggle(); }); $('.pagenavph').find('.down_jt').click(function(){ $('.pagenavph').find('.list').fadetoggle(); }); }); //建站日期设置 function sitedate(){ var now = new date(); var year = now.getfullyear(); if(year>2015){ var dash="-"; var thisyear=year; } else{ var dash=""; var thisyear="";} document.write(dash+thisyear) } // 内页导航聚焦 function submenu(num){ $(".submenu .menu li").eq(num).addclass("cur"); } /** * javascript脚本实现回到页面顶部示例 * @param acceleration 速度 * @param stime 时间间隔 (毫秒) **/ function gototop(acceleration,stime) { acceleration = acceleration || 0.1; stime = stime || 10; var x1 = 0; var y1 = 0; var x2 = 0; var y2 = 0; var x3 = 0; var y3 = 0; if (document.documentelement) { x1 = document.documentelement.scrollleft || 0; y1 = document.documentelement.scrolltop || 0; } if (document.body) { x2 = document.body.scrollleft || 0; y2 = document.body.scrolltop || 0; } var x3 = window.scrollx || 0; var y3 = window.scrolly || 0; // 滚动条到页面顶部的水平距离 var x = math.max(x1, math.max(x2, x3)); // 滚动条到页面顶部的垂直距离 var y = math.max(y1, math.max(y2, y3)); // 滚动距离 = 目前距离 / 速度, 因为距离原来越小, 速度是大于 1 的数, 所以滚动距离会越来越小 var speeding = 1 + acceleration; window.scrollto(math.floor(x / speeding), math.floor(y / speeding)); // 如果距离不为零, 继续调用函数 if(x > 0 || y > 0) { var run = "gototop(" + acceleration + ", " + stime + ")"; window.settimeout(run, stime); } }