www.gusucode.com > 22:【198-3950】景区旅游旅行官方网站类织梦模板(带手机端) > 22:【198-3950】景区旅游旅行官方网站类织梦模板(带手机端)/skin/js/index.js
/** * Index Js * @Authors Mr.Cai * @Email 297272788@qq.com * @Date 2015-06-11 */ /*导航*/ $(".m-nav dl").hover(function(){ $(this).addClass('hover').find('dd').slideDown('fast'); },function(){ $(this).removeAttr('class').find('dd').slideUp('fast'); }); $('.m-tool li').hover(function(){ $(this).find('div').show(); },function(){ $(this).find('div').hide(); }); /*全屏切换*/ $(function() { var wheel=true; $(document).on('mousewheel', function(e) { if (wheel) { if (e.originalEvent.wheelDelta > 0) { Slider.slidePrev(); } else { Slider.slideNext(); } wheel = false; clearTimeout(t); var t = setTimeout(function () { wheel = true; }, 500); } }); var divh = $(window).height()-$('.m-footer').height(); $('#slider .page').height(divh); var Slider = function() { var DURATION = 600; var count = $('#slider .page').length; var current = 0; var animating = false; function slideTo(idx) { if (animating) { return; } var up = (idx > current) || (idx == current - count + 1); var $divs = $('#slider .page'); var $current = $divs.eq(idx); var $prev = $divs.eq(current); var offset = divh; animating = true; $current.show().css({ top: up ? offset : -offset }).animate({ top: 0 }, DURATION, function() { $('.m-sliderpage-nav li').removeClass('active').eq(idx).addClass('active'); animating = false; if(idx==1){ shanshui(); } if(idx==2){ wenhua(); } if(idx==3){ gongyi(); } }); $prev.animate({ top: up ? -offset : offset }, DURATION, function() { $(this).hide(); }); var $arrow = $('.m-arrow'); if (idx == count - 1) { $arrow.hide(); } else { $arrow.show(); } current = idx; } return { slideTo: slideTo, slidePrev: function() { if (current == 0) return; slideTo(current - 1); }, slideNext: function() { if (current == (count-1)) return; slideTo(current + 1); } } }(); $('.m-arrow').on('click', function() { Slider.slideNext(); }); $('.m-sliderpage-nav li').on('click', function(){ Slider.slideTo($(this).index()); }); }); /*动画*/ $('.m-arrow').velocity({bottom:'-=10'},{loop:true,duration:500}); var img = new Image(); img.src = $('#taoyuan').attr('src'); img.onload = function() { yunhua(); touyuan(); }; function yunhua(){ $('.yun-b').velocity({top:'-60',right:'-130',opacity:0.6},{duration:10000}); setTimeout(function(){ $('.hua-b').velocity({rotateZ:3,bottom:'-=8',left:'+=8'},{loop:2,duration:1000}); $('.hua-d').velocity({rotateZ:900,top:'100%',right:'95%'},{duration:8000}); $('.yun-a').velocity({scale:1.2,left:'-=200',bottom:'30',opacity:0.5},10000); },2000); setTimeout(function(){ $('.hua-a').velocity({rotateZ:3,bottom:'-=8',left:'+=8'},{loop:2,duration:1000}); },2500); setTimeout('Loop()',5000); }; function Loop(){ $('.hua-c').velocity({rotateZ:'-3',top:'+=8',right:'-=8'},{loop:3,duration:1000}); $('.hua-e').velocity({rotateZ:900,top:'100%',right:'50%'},{duration:9000}); setTimeout(function(){ $('.hua-f').velocity({rotateZ:900,top:'80%',right:'100%'},{duration:8000}).show(); $('.hua-g').velocity({rotateZ:900,top:'100%',right:'30%'},{duration:7000}).show(); $('.hua-h').velocity({rotateZ:900,top:'100%',right:'90%'},{delay:500,duration:8000}).show(); },1800); }; function touyuan(){ $('.ty-a').velocity({right:70,opacity:1},500); $('.ty-b').velocity({right:114,opacity:1},{delay:200,duration:500}); $('.ty-c').velocity({right:170,opacity:1},{delay:400,duration:500}); $('.ty-d').velocity({right:230,opacity:1},{delay:600,duration:500}); $('.ty-e').velocity({opacity:1},{delay:800,duration:600}); $('.ty-bg').velocity({opacity:1},{delay:800,duration:600}); }; function shanshui(){ $('.ss-a').velocity({top:0,opacity:1},500); $('.ss-b').velocity({opacity:1},{delay:400,duration:500}); $('.shanshui .link').velocity({top:0,opacity:1},{delay:400,duration:500}); }; function gongyi(){ $('.gy-a').velocity({opacity:1},800); $('.gy-b').velocity({top:0,opacity:1},{delay:400,duration:800}); $('.gongyi .link').velocity({opacity:1},{delay:600,duration:800}); $('.gongyi .news').velocity({top:0,opacity:1},{delay:600,duration:800, complete:function(){ var time = setInterval('scrollNews()',5000); $('.gongyi .news').hover(function(){ clearInterval(time); },function(){ time = setInterval('scrollNews()',5000); }); } }); }; $('.gongyi .link a').hover(function(){ $(this).velocity({top:'-8'},200) },function(){ $(this).velocity({top:0},200) }); function scrollNews(){ $('.gongyi .news ul li:first').velocity({'margin-top':'-22'},{duration:300, complete:function(){ var html = $(this).html(); $(this).remove(); $('.gongyi .news ul').append('<li>'+html+'</li>') } }); }; var wh = $(window).height()-192; $('.wenhua .text-con').height(wh); function wenhua(){ var wh = $(window).height()-192; $('.wenhua .mask') .velocity({height:wh},300) .velocity({width:990},500); $('.wenhua .text-con i').velocity({top:50},{delay:600,duration:300}); $('.wh-a').velocity({height:'75%'},{delay:700,duration:300}); $('.wh-b').velocity({height:'98%'},{delay:800,duration:300}); $('.wh-c').velocity({height:'60%'},{delay:900,duration:300}); $('.wh-d').velocity({height:'95%'},{delay:1000,duration:300}); $('.wh-e').velocity({height:'90%'},{delay:1100,duration:300}); }; /*显示器尺寸兼容*/ var wh = $(document).height(); var ww = $(document).width(); if(wh<830){ taoyuanMin(); shanshuiMin() } if(ww<1280){ shanshuiMin() } $(window).resize(function(){ var wh = $(document).height(); var ww = $(document).width(); if(wh<830){ taoyuanMin(); shanshuiMin() }else{ scaleMax() } if(ww<1280){ shanshuiMin() }else{ scaleMax() } }); function taoyuanMin(){ $('.taoyuan .text-con,.hua-a,.hua-b,.hua-c,.yun-a,.yun-b').css({'zoom':'0.85','-moz-transform':'scale(0.85)'}); }; function shanshuiMin(){ $('.shanshui .text-con').css({'zoom':'0.85','-moz-transform':'scale(0.85)'}); }; function scaleMax(){ $('.taoyuan .text-con,.hua-a,.hua-b,.hua-c,.yun-a,.yun-b,.shanshui .text-con').removeAttr('style') }; $('.m-content dl').hover(function(){ $(this).addClass('hover').find('dd').slideDown() },function(){ $(this).removeAttr('class').find('dd').slideUp() });