//myJs.js $(function(){ // ditu 坐标 var jizhun = [73.498754,53.570508]; // 73.60612,39.337848 135.145078,48.474788 110.198343,18.236603 var x_=135.048492 - 73.498754; var y_ = 53.570508- 18.16022; function getX(x){ return (x - jizhun[0])/x_*100 + '%' } function getY(y){ return (jizhun[1] - y)/y_*100 + '%' } function initBuju (array_buju) { if(array_buju){ var str = '' var strcity='' var ishasmoren = 0 var bai=true for (var i =0;i'+ '
'+ // ''+ '

'+array_buju[i].city+'

'+ ''+ ''+ '
'+ ''; strcity+= getSpan(array_buju[i],bai); if(array_buju[i].types==2){ bai=false } if(!!array_buju[i].isshow){ // $('#showtext .text').html(array_buju[i].title); // $('#showtext a').attr('href',array_buju[i].url); ishasmoren = i console.log(ishasmoren) } } $('.mapcontainer').html(str); $('#cityshow').html(strcity); if($(window).width()>650){ $('.mmpp'+ishasmoren).addClass('active') $('#showimg .swiper-wrapper').html(getSwiperImg(array_buju[ishasmoren].simg_arr,array_buju[ishasmoren].title,array_buju[ishasmoren].url)); try{ slideSwiper.updateSlidesSize(); slideSwiper.slideTo(0); }catch(e){ } } // $('.maps').hover(function(){ // $(this).addClass('active').siblings('').removeClass('active'); // $('# ').attr('src',$(this).attr('iimg')); // $('#showtext .text').html($(this).attr('itext')); // $('#showtext a').attr('href',$(this).attr('ihref')); // }) } } function getCityName(obj){ if(obj.types == 2){ return '拜博'; }else{ return obj.city } } function getSpan(obj,bai){ if((bai&&obj.types == 2) || (obj.types!=2) ){ return''+getCityName(obj)+''; }else{ return ''; } } function showObjAttr(p_){ var t_ =p_.index() $('.mapcontainer').children().eq(t_).addClass('active').siblings('').removeClass('active'); $('#cityshow').children().eq(t_).addClass('active').siblings('').removeClass('active'); $('#showimg .swiper-wrapper').html(getSwiperImg(p_.attr('iimg'),p_.attr('itext'),p_.attr('ihref'))); // $('#showtext .text').html(p_.attr('itext')); // $('#showtext a').attr('href',p_.attr('ihref')); $('.mapp.showmap').fadeIn(function(){ try{ slideSwiper.update(true); slideSwiper.slideTo(0); // setTimeout(function(){ // slideSwiper.updateSlidesSize(); // slideSwiper.slideTo(0); // console.log('数据更新成功',$('#showimg .swiper-wrapper').children().size()) // setTimeout(function(){ // slideSwiper.updateSlidesSize(); // slideSwiper.slideTo(0); // },100) // },500); }catch(e){ } }) } $('.closemaap').click(function(){ $('.mapp.showmap').fadeOut() }) function clichshow(){ var p_ = $(this).parent().parent(); showObjAttr(p_) } $('.mapcontainer').on('mouseenter','.maps .pos-',clichshow) $('#cityshow').on('click','span',function(){ showObjAttr($(this)) }) function getSwiperImg(imgs,text,url){ console.log(arguments) imgs = imgs.split(';'); text = text.split(';'); url = url.split(';'); var ht =[]; var html_ ='
'+ ''+ '
'+ '
$text
'+ '了解更多>'+ '
'+ '
'; for(var i =0;i