$(document).ready(function () {
var show = 0;
// var pc_width = $(window).width();
var width = $(window).width();
var height = $(window).height();
// 移动端菜单
if (width<770) {
//手机端滑动菜单
$('.phone-style').css({'left':width+'px','width':width+'px'});
var mtime = 0;
$('.phone-btn').click(function(){
// console.log(1212);
// alert(1212);
if (mtime==0) {
$("body").on("touchmove",function(event){
event.preventdefault;
}, false);
var _sw = $(document).scrolltop();
$('.phone-style').css({'overflow-y':'hidden','top':_sw +'px','height':height+'px'});
$('body').css({'overflow-y':'hidden'});
$('.phone-style').slidedown();
$(this).find('img').attr("src","/static/mobile/images/mobile_index/menu2.png");
mtime=1;
}else{
$('body').css({'overflow-y':'auto','overflow-x': 'hidden'});
$('.phone-style').css('overflow-y','auto');
$('.phone-style').slideup();
$('.phone-style > ul').show();
$("body").off("touchmove");
$(this).find('img').attr("src","/static/mobile/images/mobile_index/menu1.png");
mtime=0;
}
});
$('.phone-style > ul > li > a').click(function(){
var values = $(this).attr("down-val");
if (values==0 || values==undefined){
$(this).siblings('ul').slidedown();
$(this).attr("down-val",1);
}else {
$(this).siblings('ul').slideup();
$(this).attr("down-val",0);
}
});
$('.back_history').click(function () {
window.history.go(-1);
})
}
//end 移动端菜单
//pc端
// banner轮播
var swiper1 = new swiper('.swiper-container1', {
autoplay:true,
loop: true,
navigation: {
nextel: '.swiper-button-next1',
prevel: '.swiper-button-prev1',
},
});
// index 集团业务
var swiper2 = new swiper('.swiper-container2', {
autoplay:true,
slidesperview: 3,
spacebetween: 30,
slidespergroup: 1,
loop: true,
loopfillgroupwithblank: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextel: '.swiper-button-next2',
prevel: '.swiper-button-prev2',
},
});
// index 新闻
var swiper3 = new swiper('.swiper-container3',{
autoplay:true,
// loop:true,
pagination: {
el: '.swiper-pagination',
clickable: true,
renderbullet: function (index, classname) {
return '' + (index + 1) + '';
},
},
navigation: {
nextel: '.swiper-button-next3',
prevel: '.swiper-button-prev3',
},
});
$(".news-left-menu li").on("click",function(){
var index = $(this).index();
swiper3.slideto(index);
});
var swiper4 = new swiper('.swiper-container4',{
pagination: {
el: '.swiper-pagination',
clickable: true,
renderbullet: function (index, classname) {
return '' + (index + 1) + '';
},
},
navigation: {
nextel: '.swiper-button-next4',
prevel: '.swiper-button-prev4',
},
on:{
slidenexttransitionstart: function(){
var num = this.activeindex;
$('.news-right-title li').removeclass('active-news');
$('.news-right-title li').eq(num).addclass('active-news');
},
slideprevtransitionstart: function(){
var num = this.activeindex;
$('.news-right-title li').removeclass('active-news');
$('.news-right-title li').eq(num).addclass('active-news');
},
},
});
$(".news-right-title li").on("click",function(){
var index = $(this).index();
swiper4.slideto(index);
});
// index end新闻
// common美食轮播
var swiper5 = new swiper('.swiper-container5', {
slidesperview: 4,
autoplay:true,
spacebetween: 30,
slidespergroup: 1,
loop: true,
loopfillgroupwithblank: true,
navigation: {
nextel: '.swiper-button-next5',
prevel: '.swiper-button-prev5',
},
});
// anning 集团业务轮播
var swiper6 = new swiper('.swiper-container6', {
slidesperview: 4,
spacebetween: 30,
slidespergroup: 1,
loop: true,
loopfillgroupwithblank: true,
navigation: {
nextel: '.swiper-button-next6',
prevel: '.swiper-button-prev6',
},
on:{
slidenexttransitionstart: function(){
var num = this.activeindex;
var totle_lengths = $('.business-swiper').length;
for (var i=0;i1700 && show==0){
if (ws >= 600){
$(".float-right").fadein();
}
if (ws < 600){
$(".float-right").fadeout();
}
}
// 移动端gotop
if (ws >= 400){
$(".m-gotop").fadein();
}else {
$(".m-gotop").fadeout();
}
});
//index end右弹窗
// anning 订房时间选择
// $('.form_date').datetimepicker({
// language: 'zh-cn',
// weekstart: 1,
// todaybtn: 1,
// format : 'yyyy-mm-dd',
// autoclose: 1,
// todayhighlight: 1,
// startview: 2,
// minview: 2,
// forceparse: 0
// });
$(".form_date").change(function(){
var bg_time = $(".bg_time").val();
var end_time = $(".end_time").val();
if (bg_time!=='' && end_time!==''){
var dt1 = new date(date.parse(bg_time));
var dt2 = new date(date.parse(end_time));
var count = (dt2-dt1)/(1000 * 60 * 60 * 24);
if (count>=0){
$('#count').val(count+" 晚");
}else {
$('#count').val(0);
}
}
});
// end 订房时间选择
// 酒店轮播
var swiper7 = new swiper('.swiper-container7', {
autoplay:true,
loop: false,
navigation: {
nextel: '.swiper-button-next7',
prevel: '.swiper-button-prev7',
},
observer:true,
});
var old_hotle = '';
var hotelname = "";
var totlecont = '';
//酒店列表
$('.hotel-box-title').click(function () {
var id = $(this).attr('id');
hotelname = id;
$('.hotel-list').slideup();
$(this).siblings('ul').slidedown();
});
$(".hotel-list li").click(function () {
var index = $(this).index();
var val = $(this).val();
$("#hotel_swiper").empty();
totlecont = '';
for (var i=1;i<=val;i++){
var dress = "'/static/mobile/images/hotel_swiper/";
var addurl = hotelname + (index+1) + i;
var suffix = ".jpg'";
var cont = '';
totlecont = totlecont + cont;
}
$("#hotel_swiper").html(totlecont);
swiper7.update();
// swiper-wrapper
$(".hotel-list li.hotel-active").removeclass("hotel-active");
$(this).addclass("hotel-active");
});
//end酒店列表
// 文章列表
$(".article-el-content li").click(function () {
var index = $(this).index();
if (index==0){
$('#el0').show();
$('#el1').hide();
}else {
$('#el0').hide();
$('#el1').show();
}
});
//end pc端
// 移动端
// 下属品牌
var swiper11 = new swiper('.swiper-container11', {
slidesperview: 'auto',
centeredslides: true,
spacebetween: 15,
grabcursor: true,
loop:true,
roundlengths : true
});
// 集团业务
var swiper12 = new swiper('.swiper-container12', {
slidesperview: 'auto',
centeredslides: true,
spacebetween: 15,
grabcursor: true,
loop:true,
roundlengths : true,
pagination: {
el: '.swiper-pagination12',
clickable: true,
},
});
//美食
var swiper13 = new swiper('.swiper-container13', {
slidesperview: 'auto',
centeredslides: true,
spacebetween: 15,
grabcursor: true,
loop:true,
roundlengths : true
});
// 新闻
var swiper14 = new swiper('.swiper-container14', {
slidesperview: 'auto',
centeredslides: true,
grabcursor: true,
roundlengths : true,
pagination: {
el: '.swiper-pagination14',
clickable: true,
renderbullet: function (index, classname) {
return '' + (index + 1) + '';
},
},
on:{
slidenexttransitionstart: function(){
var num = this.activeindex;
$('.m-news-list li').removeclass('liactive');
$('.m-news-list li').eq(num).addclass('liactive');
},
slideprevtransitionstart: function(){
var num = this.activeindex;
$('.m-news-list li').removeclass('liactive');
$('.m-news-list li').eq(num).addclass('liactive');
},
},
});
//新闻
$('.m-news-list li').click(function () {
var index = $(this).index();
swiper14.slideto(index);
$('.m-news-list li').removeclass('liactive');
$(this).addclass('liactive');
});
// 视频
$('.m-video-right li').click(function () {
var index = $(this).index();
video1.pause();
video2.pause();
video3.pause();
$('.m-video-left').removeclass('video-show');
$('#m-video-show' + index).addclass('video-show');
});
// 视频
$('.video-left-box').click(function () {
var index = $(this).attr('id');
$('.video-left-text').removeclass('video-active');
$(this).children("div").addclass('video-active');
if (index=="pc_video3"){
video4.src('/static/mobile/video/video1.mp4');
video4.poster('/static/mobile/images/video/video1_bg.jpg');
}
if (index=="pc_video2"){
video4.src('/static/mobile/video/video2.mp4');
video4.poster('/static/mobile/images/video/video3_bg.jpg');
}
if (index=="pc_video1"){
video4.src('/static/mobile/video/video3.mp4');
video4.poster('/static/mobile/images/video/video2_bg.jpg');
}
});
// anning 温泉特色
var swiper15 = new swiper('.swiper-container15', {
slidesperview: 'auto',
centeredslides: true,
spacebetween: 15,
grabcursor: true,
loop:true,
roundlengths : true
});
//end 移动端
});