$(function() {
$(".top .nav ul li:last-child").css("padding-right", "0");
$(".top .nav ul li:last-child").css("background-image", "none");
$(".h-ann li:last-child").css("margin-right", "0");
//首页选项卡声明切换和下边的配合使用
HomeTag(".h-two");
//语言切换选择
$('.language').hover(function() {
$(this).children('ul').show();
}, function() {
$(this).children('ul').hide();
});
$('.language ul>li').hover(function() {
var index = $(this).prevAll().length;
$(this).children('ul').css('top', index * $(this).height()).show();
}, function() {
$(this).children('ul').hide();
}).find('ul').hide();
//首页选项卡切换
function HomeTag() {
var tagheader = $("#htag").find("li");
tagheader.eq(0).addClass("on");
$(".content .news").eq(0).show();
var taglen = tagheader.length;
tagheader.mouseover(function() {
$(this).addClass("on").siblings("li").removeClass("on");
var _curindex = $(this).index("#htag li");
$(".content .news").eq(_curindex).show().siblings("ul").hide();
});
}
//友情链接弹出
$('.links-box').each(function(index,el){
var $i = $('');
$(el).append($i);
var $p = $(el).find('p');
var $list = $(el).find('.links-list');
$p.add($i).click(function() {
if ($list.css("display") == "none") {
$list.stop().slideDown(300);
$i.show();
} else {
$list.stop().slideUp(300);
$i.hide();
}
})
});
// 技术支持常见问题
$('.two-tit').eq(0).addClass('cur').next().show();
$(".two-tit").click(function() {
$('.two-tit').removeClass("cur").next().slideUp();
$(this).addClass("cur").next().slideDown();;
})
// 产品子菜单
//快速申请
$('.sample-content .two table').each(function(index,el){
var html1 = '
'+i+'');
}
$(this).change(function(event){
monthActive($(this).next()[0]);
});
}
if(this.name == 'month'){
for(var i=12;i>0;i--){
$(this).prepend('');
}
$(this).change(function(event){
monthActive(this);
});
monthActive(this);
}
if(this.name == 'date'){
$(this).html('');
for(var i=dateN;i>0;i--){
$(this).prepend('');
}
}
});
function monthActive(_this){
if(_this.value==4||_this.value==6||_this.value==9||_this.value==11){
dateN = 30;
}else if(_this.value==2){
yearN = parseInt($(_this).prev()[0].value);
if((yearN%4==0&&yearN%100!=0)||(yearN%400==0)){
dateN = 29;
}else{
dateN = 28;
}
}else{
dateN = 31;
}
dateActive($(_this).next()[0]);
}
function dateActive(_this){
$(_this).html('');
for(var i=dateN;i>0;i--){
$(_this).prepend('');
}
}
//honor
$('.honor').each(function(index,el){
var $btn = $(el).find('i');
var $bigImg = $(el).find('.bigImg');
var $wrap = $(el).find('p');
var $img = $(el).find('a');
$wrap.append($img.clone());
$wrap.append($img.clone());
$img = $(el).find('a');
var w = $img.outerWidth(true);
var len = $img.length;
var len1 = len/3;
var len2 = len1*2;
$wrap.css('left','-'+w/3*len+'px');
$wrap.width(w*len);
var middleW1 = w*len1;
var middleW2 = w*len2;
$img.eq(0).addClass('cur');
$img.eq(0+len1).addClass('cur');
$img.eq(0+len2).addClass('cur');
$bigImg.append($img.eq(0).clone());
$btn.click(function(event){
var symbol = $(this).hasClass('next')?'-':'+';
$wrap.stop(true,true).animate({'left':symbol+'='+w+'px'},500,function(){
if((-1)*parseInt($(this).css('left'))>=middleW2){
$wrap.css('left','-'+middleW1+'px');
}else if(parseInt($(this).css('left'))===0){
$wrap.css('left','-'+middleW1+'px');
}
});
var index = $wrap.find('.cur').eq(0).index()%len1;
$img.removeClass('cur');
$img.eq(symbol=='-'?(((index+1)+len1)%len1):(((index-1)+len1)%len1)).trigger('click');
// $img.eq(symbol=='-'?(((index+1)+len1)%len1):(((index-1)+len1)%len1)).addClass('cur');
// $img.eq(symbol=='-'?(((index+1)+len1)%len1+len1):(((index-1)+len1)%len1+len1)).addClass('cur');
// $img.eq(symbol=='-'?(((index+1)+len1)%len1+len2):(((index-1)+len1)%len1+len2)).addClass('cur');
});
$img.click(function(event){
event.preventDefault();
if(!$(this).hasClass('cur')){
$bigImg.find('a').remove();
$bigImg.append($(this).clone());
$img.removeClass('cur');
var index = $(this).index()%len1;
$img.eq(index).addClass('cur');
$img.eq(index+len1).addClass('cur');
$img.eq(index+len2).addClass('cur');
}
});
});
//selection
$('.selection').each(function(index, el){
var $btn = $(el).find('.options i');
$btn.toggle(function(){
var $p = $(this).parent();
$p.css('height','auto');
var h = $p.outerHeight(true);
$p.siblings('h4').find('span').height(h);
$(this).addClass('close');
},function(){
var $p = $(this).parent();
$p.removeAttr('style');
$p.siblings('h4').find('span').removeAttr('style');
$(this).removeClass();
});
});
//index login
$('.login a').each(function(index,el){
$(el).click(function(event){
event.preventDefault();
$('.popup').eq(index).show();
$('.popupBg').show();
});
});
$('.erji-cont .right-cont .sample-content .one p span').each(function(index,el){
$(el).css('cursor','pointer').click(function(event){
event.preventDefault();
$('.popup').eq(index).show();
$('.popupBg').show();
});
});
$('.popup').each(function(index,el){
$(el).find('.close').click(function(event){
$('.popupBg').hide();
$('.popup').hide();
$(el).hide();
});
});
$('.popupBg').click(function (event) {
$('.popupBg').hide();
$('.popup').hide();
$(this).hide();
});
$('.header .register').css('cursor','pointer').click(function(){
$(this).parent().parent().siblings('.close').trigger('click');
$('.login a').eq(1).trigger('click');
});
$('.popup .forget').css('cursor','pointer').click(function(event){
$(this).parent().parent().siblings('.close').trigger('click');
$('.popup').eq(2).show();
$('.popupBg').show();
});
$('.header .popup1 .register').css('cursor','pointer').unbind().click(function(){
$(this).parent().parent().siblings('.close').trigger('click');
$('.login a').eq(0).trigger('click');
});
//$('.erji-cont .right-cont .pro-content2 tr td:nth-child(10)').each(function (index, el) {
// $(el).css('cursor', 'pointer').click(function (event) {
// event.preventDefault();
// var top = ($(window).height() - $('.productPopup').outerHeight(true)) / 2 + $(window).scrollTop();
// $('.productPopup').removeAttr('style').css('top', top + 'px').show();
// $('.popupBg').show();
// $('.popup .sgBtn.cancel').unbind().click(function (event) {
// $(this).parent().siblings('.close').trigger('click');
// });
// // $('.productPopup .close').unbind().click(function(event){
// // $('.productPopup+.popupBg').hide()
// // $('.productPopup').hide();
// // });
// });
//});
$('.applypro').each(function (index, el) {
$(el).css('cursor','pointer').click(function(event){
event.preventDefault();
var pname = $(this).attr('title');
$.get('/ajax/applypro.aspx', { act: 'addcar', pname: pname, pnum: 1 }, function (data) {
if (data == 'ok') {
var top = ($(window).height() - $('.productPopup').outerHeight(true)) / 2 + $(window).scrollTop();
$('.productPopup').removeAttr('style').css('top', top + 'px').show();
$('.popupBg').show();
$('.popup .sgBtn.cancel').unbind().click(function (event) {
$(this).parent().siblings('.close').trigger('click');
});
$('.productPopup .ok').unbind().click(function (event) {
location.href = 'member.aspx';
});
}
})
//var data_id = $(this).attr('data-id');
//var v_id;
//if ($.cookie('key') != null) {
// v_id = $.cookie('key') + ',' + data_id;
//} else {
// v_id = data_id;
//}
//$.cookie('key', v_id, { path: 'member.aspx' });
});
});
// $('.selection .apply').eq(1).trigger('click');
//$(".data").each(function(index,el){
// $(el).datetimepicker({
// lang:"ch", //语言选择中文
// format:"Y-m-d", //格式化日期
// timepicker:false
// });
//});
//header 三级菜单
function smenu(){
$('.top .nav>div>ul>li>a').each(function(index,el){
var timer = null;
var $smenu = $(el).siblings('.smenu');
$(el).add($(el).siblings('.smenu')).each(function(){
$(this).unbind().mouseenter(function(event){
clearTimeout(timer);
$smenu.stop(true,true).slideDown(400);
}).mouseleave(function(event){
timer = setTimeout(function(){
$smenu.stop(true,true).slideUp(400);
},200);
});
});
});
}
smenu();
// .h-two .two-left .content .news
$('.h-two .two-left .content .news img').each(function(index,el){
if(!$(this).attr('src')){
$(this).remove();
}
});
//$('.onlyInte').keydown(function(event){
// this.value=this.value.replace(/[\D]/g,'');
//});
});
|