$(document).ready(function () { $(".drop-down-menu ul li").mouseover(function() { $(this).children("ul").show(); $(this).addClass("hover"); $(this).children(".icon01").hide(); $(this).children(".icon02").show(); }); $(".drop-down-menu ul li").mouseout(function() { $(this).children("ul").hide(); $(this).removeClass("hover"); $(this).children(".icon01").show(); $(this).children(".icon02").hide(); }); $(".drop-menu-click ul li").click(function() { $(this).children("ul").show(); $(this).addClass("hover"); $(this).children(".icon01").hide(); $(this).children(".icon02").show(); }); var noclassimg = { 'margin-right':'0px', 'float':'right' }; $("[name=liall2]").each(function(){ $(this).children().each(function(index,element){ if((index+1)%2 ==0){ $(this).css(noclassimg); } }); }); $("[name=liall4list]").each(function(){ $(this).children().each(function(index,element){ if((index%4) ==0){ $(this).addClass('a1'); }else if((index%4)==1){ $(this).addClass('a1'); }else if((index%4)==2){ $(this).addClass('a3'); }else if((index%4)==3){ $(this).addClass('a3'); } }); }); $("[name=liall6list]").each(function () { $(this).children().each(function (index, element) { if ((index % 6) == 0) { $(this).addClass('a1'); } else if ((index % 6) == 1) { $(this).addClass('a1'); } else if ((index % 6) == 2) { $(this).addClass('a1'); } else if ((index % 6) == 3) { $(this).addClass('a3'); } else if ((index % 6) == 4) { $(this).addClass('a3'); } else if ((index % 6) == 5) { $(this).addClass('a3'); } }); }); $("[name=liall3]").each(function(){ $(this).children().each(function(index,element){ if((index+1)%3 ==0){ $(this).css(noclassimg); } }); }); $("[name=liall3a]").each(function(){ $(this).children().each(function(index,element){ if((index+1)%3 ==0){ $(this).css(noclassimg); } }); }); $("[name=liall4]").each(function(){ $(this).children().each(function(index,element){ if((index+1)%4 ==0){ $(this).css(noclassimg); } }); }); $("[name=liall5]").each(function(){ $(this).children().each(function(index,element){ if((index+1)%5 ==0){ $(this).css(noclassimg); } }); }); //图片切换 $(".imgmore").each(function(i,v){ JDT("#fl_focus_"+(i+1)); }); $(".imgmore1").each(function(i,v){ JDT("#f2_focus_"+(i+1)); }); //下面的分享 var content_h = $(".con-tent").height(); if (content_h > 300) { $(".down-share").css('display','block'); } else { $(".down-share").css('display','none'); }; $('#close-btn').click(function(){ $('.browser-warning').hide(); }); $(".add-type a").addClass('type-show'); $(".add-type a:last-child").show(); //菜单悬浮 try{ var a = document.getElementById("top-menu").offsetTop; $(window).scroll(function() { var h_num = $(window).scrollTop(); if (h_num > a) { $('#top-menu').addClass('fixer'); $('.yb_top').css('display','block'); $('.pub-menu-new>.drop-down-menu>ul>li>ul').removeClass('left-m'); } else { $('#top-menu').removeClass('fixer'); $('.yb_top').css('display','none'); $('.pub-menu-new>.drop-down-menu>ul>li>ul').addClass('left-m'); } }); }catch (e) { } //导航菜单悬浮 try{ var c = document.getElementById("load-buy").offsetTop; $(window).scroll(function() { var h_num = $(window).scrollTop(); if (h_num > c) { $('#load-buy').addClass('fixer-sub'); $('#load-buy').css('width','1000px'); $('.r-btn-white').show(); } else { $('#load-buy').removeClass('fixer-sub'); $('#load-buy').css('width','100%'); $('.r-btn-white').hide(); } }); }catch (e){ } //右边菜单悬浮 try{ var f = document.getElementById("r-alert").offsetTop; $(window).scroll(function() { var h_num = $(window).scrollTop(); if (h_num > f) { $('#r-alert').addClass('fixer-right'); $(".show-hide").fadeIn(); } else { $('#r-alert').removeClass('fixer-right'); $(".show-hide").fadeOut(); } }); }catch (e){ } // 返回顶部 $(".yb_top").click(function() { $("html,body").animate({ 'scrollTop': '0px' }, 300) }); $(window).scroll(function() { if ($(window).scrollTop() >= 100) {//向下滚动像素大于这个值时,即出现~ $('.actGotop').fadeIn(300); //淡入的时间,越小出现的越快~ } else { $('.actGotop').fadeOut(300); //淡出的时间,越小消失的越快~ } }); $('.actGotop').click(function() { $('html,body').animate({ scrollTop : '0px' }, 800); }); $('.r-floor>ul>li>a').each(function(k,v){ //k - 选择器的 index 位置 , v - 当前的元素(也可使用 "this" 选择器) $(v).mouseenter(function(){ $(v).children('.top1').show() $(v).children('.top2').show().animate({right:'0px'}); $(v).children('.top1').css('background','#F39800'); }); $(v).mouseleave(function(){ $(v).children('.top1').show().animate({right:'0px'}); $(v).children('.top2').hide().animate({right:'-100px'}); $(v).children('.top1').css('background','#8c8c8c'); }); }); try{ var x = 10; var y = 20; $(".tooltip").mouseover(function(e){ this.myTitle = this.title; this.title = ""; var tooltip = "
"+ this.myTitle +"<\/div>"; //创建 div 元素 文字提示 $("body").append(tooltip); //把它追加到文档中 $("#tooltip") .css({ "top": (e.pageY+y) + "px", "left": (e.pageX+x) + "px" }).show("fast"); //设置x坐标和y坐标,并且显示 }).mouseout(function(){ this.title = this.myTitle; $("#tooltip").remove(); //移除 }).mousemove(function(e){ $("#tooltip") .css({ "top": (e.pageY+y) + "px", "left": (e.pageX+x) + "px" }); }); }catch (e) { } $('a[href*=#]').click(function() { var target = jQuery(this.hash); target = target.length && target || jQuery('[name=' + this.hash.slice(1) + ']'); if (target.length) { var targetOffset = target.offset().top; jQuery('html,body').animate({ scrollTop : targetOffset }, 1000); //return false; } }); $('.input-select').each(function(){ var ele = $(this), menu = $('.select_menu', ele), inputTxt = $('input[type=text]', ele), inputVal = $('input[type=hidden]',ele), timer; inputTxt.hover(function(){ menu.fadeIn("fast"); inputTxt.removeClass("arrow-small-select"); inputTxt.addClass("arrow-small-down"); }); $(menu).delegate('dt,option', 'click', function(){ var dtele = $(this), name = dtele.html(), value = dtele.data('value'); //var dtele = $(this), name = dtele.data('name'), value = dtele.data('value'); inputTxt.val(name); //ele.data('value', value); inputVal.val(value); ele.change(); menu.fadeOut('fast'); inputTxt.removeClass("arrow-small-down"); inputTxt.addClass("arrow-small-select"); }) ele.mouseout(function(){ clearTimeout(timer); timer = setTimeout(function(){ menu.fadeOut('fast'); }, 200); }) ele.mouseover(function(){ clearTimeout(timer); }) }); $('.show-hide-data').each(function() { //var showli = $(this).find('ul').children('li').length; var showli = $(this).find('ul li').length; //alert(showli); if(showli <= 0){ $(this).find('.icon-nodata').show(); $(this).find('.show-hide-article').show(); $(this).find('.send').show(); } }); $('.show-hide-data.l-8').each(function() { //var showli = $(this).find('ul').children('li').length; var articleshow = $(this).find('ul li').length; //alert(showli); if(articleshow <= 8){ $('.show-hide-article').show(); } }); $("ul.tab-floor-r>.sub").each(function(){ var tabfloor = $(this).find('a').length; //alert(tabfloor); if(tabfloor > 8){ $(this).addClass('scroll'); } }); var lay2num = 13; $(".tab-list.select.lay2>a:gt(" + lay2num + ")").hide(); $('.select-more.lay2').click(function () { $('.tab-list.select.lay2>a:gt(' + lay2num + ')').show(); $(this).hide(); $('.select-more-top.lay2').show(); }); $('.select-more-top.lay2').click(function () { $('.tab-list.select.lay2>a:gt(' + lay2num + ')').hide(); $(this).hide(); $('.select-more.lay2').show(); }); }); //tab切换 function setTab(i, x) { var n = document.getElementById("menu" + i).getElementsByTagName("li"); var k = document.getElementById("main" + i).children; for ( m = 0; m < n.length; m++) { if (m == x) { n[m].className = "menuFocus" + i; k[m].style.display = "block"; } else { n[m].className = "menuNormal" + i; k[m].style.display = "none"; } } }; function setTabDL(i, x) { var ndl = document.getElementById("menudl" + i).getElementsByTagName("dt"); var kdl = document.getElementById("maindl" + i).children; for ( mdl = 0; mdl < ndl.length; mdl++) { if (mdl == x) { ndl[mdl].className = "focus" + i; kdl[mdl].style.display = "block"; } else { ndl[mdl].className = "normal" + i; kdl[mdl].style.display = "none"; } } }; function setTabMore(i, x) { var u = document.getElementById("menum" + i).getElementsByTagName("li"); var sub = document.getElementById("menum" + i).getElementsByTagName("div"); var v = document.getElementById("mainm" + i).children; for ( w = 0; w < u.length; w++) { if (w == x) { u[w].className = "menuFocus" + i; v[w].style.display = "block"; sub[w].style.display = "block"; } else { u[w].className = "menuNormal" + i; v[w].style.display = "none"; sub[w].style.display = "none"; } } }; //tab切换 function setTabUl(obj, x) { $('#menuul1').children("pre").removeClass('focus'); $(obj).addClass('focus'); $('#menuul1').children("div").hide(); $("#mainul" + x).show(); }; function winOpen(){ $('.win-con').fadeIn(); }; function winClose(){ $('.win-con').fadeOut(); }; function outTag(str){ return str.replace(/<[^>]+>/g,"");//去掉所有的html标记 } function getLocalTime(nS) { return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' '); }