airport/CN/js/script.js

304 lines
9.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

window.onload;
$(window).resize(wah);
function wah() {
}
$(window).scroll(function(event) {
if ($(window).scrollTop() > 0) {
//$('.head_box').addClass('active');
} else {
//$('.head_box').removeClass('active');
}
if ($(window).scrollTop() > 400) {
$('.gotop').addClass('active');
} else {
$('.gotop').removeClass('active');
}
})
// $(window).on("load", function() {
// setTimeout(function() {
// $('.loading').fadeOut();
// }, 4000);
// var style;
// for (var i=0; i<document.styleSheets.length; i++) {
// if (document.styleSheets[i].title == "new") {
// style = document.styleSheets[i];
// }
// }
// var top = 0;
// var left = 0;
// var length = 0;
// var angle = 0;
// var width = $('.index-tianfu').width();
// var height = $('.index-tianfu').outerHeight();
// //线条position设置为absolute时坐标需要重新定位获取单元格的偏移量作为线条的偏移量
// top = $('.index-tianfu').offset().top;
// left = $('.index-tianfu').offset().left;
// angle = Math.round(Math.atan(width/height)*180/Math.PI);//获取对角线角度Math.atan()获取的是弧度乘于180/pi得到角度
// length = Math.sqrt(width * width + height * height);//获取对角线长度,勾股定理
// $('style').append('.index-tianfu .fly::before {content: ""; position: absolute; width: 5px;left:2px;top:100%;transform-origin: top;height: ' + (length/2) + 'px; transform: rotate(-' + (180-angle) + 'deg);background-image: linear-gradient(to top, rgba(60, 149, 169, .9) , rgba(60, 149, 169, .0));}.index-tianfu .fly::after { transform: rotate(-' + (90-angle) + 'deg) translate(-50%,-50%);}');
// $('style').append('.index-tianfu .dfly::before {content: ""; position: absolute; width:5px;left:2px;top:0;transform-origin: top;height: ' + (length/2) + 'px; transform: rotate(-' + angle + 'deg);background-image: linear-gradient(to top, rgba(60, 149, 169, .9) , rgba(60, 149, 169, .0));}.index-tianfu .dfly::after { transform: rotate(' + (90-angle) + 'deg) translate(-50%,-50%);}');
// //console.log(angle)
// /*$('style').append('.index-tianfu .box .fly::before{conteont:"";position:absolute;left:0;top:100%; transform-origin: top;height: ' + length + 'px; transform: rotate(-' + (180-angle) + 'deg);background-image: linear-gradient(to top, rgba(60, 149, 169, .9) , rgba(60, 149, 169, .0));}');
// */
// })
$(function() {
$('.nav_btn').click(function() {
if ($('.nav_btn').attr('class') == 'nav_btn cur') {
$('.nav_btn').removeClass('cur');
$('.head_box .pull-right .lower-box').stop(true,true).slideUp();
$('body').css('overflow', 'inherit');
} else {
$('.nav_btn').addClass('cur');
$('.head_box .pull-right .lower-box').stop(true,true).slideDown();
$('body').css('overflow', 'hidden');
}
});
$('.head_box .pull-right .top-box .link-box .between-center').click(function(){
if($(this).find('i').text() == '中文'){
$(this).find('i').text('EN')
}else{
$(this).find('i').text('中文')
}
})
$('.ewm_tc').click(function() {
$(this).fadeOut();
})
if ($(window).width() <= 1204) {
$('.head_box .pull-right .top-box .link-box .between-center').click(function(){
$('.nav_btn').removeClass('cur');
$('.head_box .pull-right .lower-box').stop(true,true).slideUp();
$('body').css('overflow', 'inherit');
})
$('.sidebar .title').click(function(){
if($('.sidebar .title').attr('class') != 'title active'){
$('.sidebar .center-block').stop(true,true).slideDown()
$('.sidebar .title').addClass('active')
}else{
$('.sidebar .center-block').stop(true,true).slideUp()
$('.sidebar .title').removeClass('active')
}
})
} else {
$('.head_box .pull-right .lower-box ul li').hover(function() {
if ($(this).attr('clsss') != 'active') {
// $('.head_box .pull-right .lower-box ul li').removeClass('active').eq($(this).index()).addClass('active');
$('.head-menu .center-block').hide().eq($(this).index()).show();
}
})
$('.head-menu .center-block').mouseleave(function() {
$('.head-menu .center-block').hide()
})
$('.head_box .pull-right .top-box').mouseenter(function() {
$('.head-menu .center-block').hide()
})
}
//$('.index-tianfu .center-block ul').eq(0).find('li').hide().eq(0).show();
//$('.index-tianfu .center-block ul').eq(1).find('li').show().eq(0).hide();
//$('.index-tianfu .center-block ul').eq(1).find('li').click(function(){
// $('.index-tianfu .center-block ul').eq(0).find('li').hide().eq($(this).index()).show();
// $('.index-tianfu .center-block ul').eq(1).find('li').show().eq($(this).index()).hide();
//})
$(".gotop").click(function() {
var anh = $("body").offset().top;
$("html,body").stop().animate({
scrollTop: anh
}, 1000);
scrollAnh = 0;
scrollNum = 0;
});
//tab切换
$(".nav-tab li").off("click").on("click", function() {
var index = $(this).index();
$(this).addClass("active").siblings().removeClass("active");
$(".nav-box .tab-item").eq(index).addClass("active").siblings().removeClass("active");
});
$('.index-banner .search-box .pull-right .top-box div').click(function() {
if ($(this).attr('clsss') != 'active') {
$('.index-banner .search-box .pull-right .top-box div').removeClass('active').eq($(this).index())
.addClass('active');
}
})
$('.head_box .pull-right .top-box .search-box').mouseenter(function() {
$(this).addClass('active');
})
$('.head_box .pull-right .top-box .search-box .text').click(function() {
$('.head_box .pull-right .top-box .search-box ul').show();
})
$('.head_box .pull-right .top-box .search-box i').click(function() {
$('.head_box .pull-right .top-box .search-box').removeClass('active');
$('.head_box .pull-right .top-box .search-box ul').hide();
})
$('.head_box .pull-right .top-box .search-box').mouseleave(function() {
$('.head_box .pull-right .top-box .search-box').removeClass('active');
$('.head_box .pull-right .top-box .search-box ul').hide();
})
$('.f-r.box-content').hide().eq(0).show();
//首页头部轮播
var indexBanner = new Swiper('.banner-swiper', {
autoplay: {
delay: 4000
},
effect : 'fade',
speed:1500,
autoplayDisableOnInteraction: false,
loop: true,
indexNum:1,
indexNum2:1,
navigation: {
nextEl: '.icon-next',
prevEl: '.icon-prev',
},
on: {
init: function(swiper) {
slide = this.slides.eq(0);
slide.addClass('ani-slide');
},
slideChange: function() {
var indexR = this.realIndex;
// 过滤重复动作
if (indexR == 0 && this.indexNum == 0) {
return false;
}
// 当下标为0时
if (indexR == 0) {
this.indexNum = 0;
} else {
this.indexNum = 1;
}
var index = this.activeIndex;
slide = this.slides.eq(index);
slide.addClass('ani-slide');
},
transitionEnd: function() {
var indexR = this.realIndex;
// 过滤重复动作
if (indexR == 0 && this.indexNum2 == 0) {
return false;
}
// 当下标为0时
if (indexR == 0) {
this.indexNum2 = 0;
} else {
this.indexNum2 = 1;
}
var index = this.activeIndex;
for ( var i = 0; i < this.slides.length; i++) {
if(i==index){
}else{
slide = this.slides.eq(i);
slide.removeClass('ani-slide');
slide.removeClass('ani-slide2');
}
}
},
},
});
//首页头部轮播
var wcBanner = new Swiper('.wc-swiper', {
speed: 1000,
loop: true,
navigation: {
nextEl: '.icon-next',
prevEl: '.icon-prev',
},
noSwiping : true,
pagination: {
el: '.wc-page',
clickable: true,
type: 'fraction',
},
});
$(".fix-box .close-gb").click(function(){
$(".fix-box").fadeOut();
})
//鼠标覆盖停止自动切换
/* wcBanner.el.onmouseover = function(){
wcBanner.autoplay.stop();
}
//鼠标离开开始自动切换
wcBanner.el.onmouseout = function(){
wcBanner.autoplay.start();
}*/
});
function sidebarTab(that,obj){
$('.sidebar ul li').removeClass('active');
$(that).addClass('active');
$('.f-r.box-content').hide();
$("#"+obj).show();
}
function query() {
var departure = $("#departure").prop('checked');
var arrival = $("#arrival").prop('checked');
var time = $("#time").val();
var flightno = $("#flightno").val();
if (departure){
window.location.href = "/flight/departure/departure.html?time=" + time + "&flightno=" + flightno;
}
if(arrival){
window.location.href = "/flight/arrival/arrival.html?time=" + time + "&flightno=" + flightno;
}
}
function check(str){
var temp="";
for(var i=0;i<str.length;i++){
if(str.charCodeAt(i)>0&&str.charCodeAt(i)<255){
temp+=str.charAt(i)
}
}
return temp;
}