| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- $(function(){
- $('.index_tt .banner_txt').eq(0).show().siblings().hide();
- var $ct=$('.banner_box ul'),
- $items=$ct.children(),
- $pre=$('.index_pre'),
- $next=$('.banner_next'),
- imgCount=$items.length,
- imgWidth=$items.width();
- $ct.append($items.first().clone());
- $ct.prepend($items.last().clone());
- var newCount=$ct.children().length;
- $ct.css({marginLeft:0-imgWidth,width:newCount*imgWidth});
- $next.on('click',function(){
- playnext();
- })
- $pre.on('click',function(){
- playpre();
- })
- var curidx =0;
- var mov = 1;
- function playnext(){
- $ct.animate({marginLeft:'-='+mov*imgWidth},1000,function(){
- curidx+=mov;
- if(curidx===imgCount){
- $ct.css({marginLeft:0-imgWidth});
- curidx=0;
- }
- })
- $('.index_tt .banner_txt').eq(curidx).show().siblings().hide();
- }
- function playpre(){
- $ct.animate({marginLeft:'+='+mov*imgWidth},1000,function(){
- curidx-=mov;
- if(curidx<0){
- $ct.css({marginLeft:0-imgWidth*imgCount});
- curidx=imgCount-1;
- }
- })
- $('.index_tt .banner_txt').eq(curidx).show().siblings().hide();
- }
-
- var timer=setInterval(playnext,3000)
- $('.banner').mouseenter(function(){
- clearInterval(timer)
- })
- $('.banner').mouseleave(function(){
- timer=setInterval(playnext,3000)
- })
- $('.img_list ol li').hover(function(){
- var simg = $(this).children('img').attr('src')
- $('.banner_box ul li').eq(curidx+1).find('img').attr('src',simg)
- })
- //导航
- $(window).scroll(function(){
- var scrolltop=$(document).scrollTop()
- if(scrolltop>400){
- $('header').addClass('h_fix')
- $('body').css({paddingTop:'74px'})
- }else{
- $('header').removeClass('h_fix')
- $('body').css({paddingTop:0})
- }
- });
-
- //挂件
- $('.pendent_box').click(function(e){
- e.preventDefault();
- $("body,html").animate({scrollTop:0},1000)
- });
- //登陆页面
-
- var hht=$(window).height();
- $('.login').height(hht);
- $('#Lo_user').focus(function(){
- var use=$(this).val()
- if(use=='用户名/邮箱/手机'){
- $(this).val('').css({color:'#333333'})
- }
-
- })
- $('#Lo_user').blur(function(){
- var use=$(this).val();
- if(use==''){
- $(this).val('用户名/邮箱/手机').css({color:'#cccccc'})
- }
- })
- $('#Lo_pass').focus(function(){
- var use=$(this).val()
- if(use=='请输入密码'){
- $(this).attr('type',"password");
- $(this).val('').css({color:'#333333'});
- }
- });
- $('#Lo_pass').blur(function(){
- var use=$(this).val();
- if(use==''){
- $(this).attr('type',"text");
- $(this).val('请输入密码').css({color:'#cccccc'})
- }
- });
- $('#checks').attr('checked',true)
- $('#checks').click(function(){
- var Cheack=$(this).prop('checked')
- if(Cheack){
- $(this).parent().css({"background":"url(../img/check_lo.png) no-repeat center left","background-size":"34% 40%"})
- $('#checkst').prop('checked',false)
- $('#checkst').parent().css({"background":"url(../img/check_lono.png) no-repeat center left","background-size":"34% 40%"})
- }else{
- $('#checkst').prop('checked',true)
- $('#checkst').parent().css({"background":"url(../img/check_lo.png) no-repeat center left","background-size":"34% 40%"})
- $(this).parent().css({"background":"url(../img/check_lono.png) no-repeat center left","background-size":"34% 40%"})
- }
- })
- $('#checkst').click(function(){
- var Cheack_no=$(this).prop('checked')
- if(Cheack_no){
- $(this).parent().css({"background":"url(../img/check_lo.png) no-repeat center left","background-size":"34% 40%"})
- $('#checks').prop('checked',false)
- $('#checks').parent().css({"background":"url(../img/check_lono.png) no-repeat center left","background-size":"34% 40%"})
- }else{
- $('#checks').prop('checked',true)
- $('#checks').parent().css({"background":"url(../img/check_lo.png) no-repeat center left","background-size":"34% 40%"})
- $(this).parent().css({"background":"url(../img/check_lono.png) no-repeat center left","background-size":"34% 40%"})
- }
- })
- //点击x
- $('.log_del').click(function(){
- $('#Lo_user').val('');
- $('#Lo_user').focus();
- $('#Lo_user').css({color:'#333333'});
- })
- // 登陆事件
- $('.login').hide()
- $('.head_login').click(function(e){
- e.preventDefault();
- $('.login').fadeIn(800)
- })
- $('.login_close').click(function(){
- $('.login').fadeOut(800)
- })
- $('form').submit(function(){
- var Suser=$('#Lo_user').val();
- var Spass=$('#Lo_pass').val();
- if(Suser==''||Spass==''||Suser=='用户名/邮箱/手机'||Spass=='请输入密码'){
- return false;
- }else{
- return true;
- }
- })
-
-
- })
|