$(function () { var clientWidth = document.body.clientWidth; if (clientWidth <= 768) { // 手机端删除video slide及video弹窗 $("#video-pop-container").remove() $("#video-slide").remove(); $("#video-slide1").remove() }else{ // 点击视频查看详情 弹出视频弹窗 $('#full-video-btn').on('click', function () { $('.video-pop-container').fadeIn() }) // 绑定关闭视频弹窗事件 $('.video-pop-close').on('click', function () { $('.video-pop-container').fadeOut() }) } // Banner 轮播 var bannerSwiper = createBannerSwiper(); // 滚动监听 处理导航效果 // $(document).on('scroll',handleScroll) // 专家轮播 var expertSwiper = createExpertSwiperInstance(clientWidth); // 初始化地图 initMap(); // 多行文本溢出 var expertElements = $(".expert-intro"); for (var index = 0; index < expertElements.length; index++) { var el = expertElements[index]; $clamp(el, { clamp: 3 }); } }); function handleScroll() { var scrollTop = $(document).scrollTop(); var navEl = $(".nav-container"); if (scrollTop > 68) { navEl.addClass("hasBgColor"); } else { navEl.removeClass("hasBgColor"); } } // banner swiper instance function createBannerSwiper() { return new Swiper(".banner-container", { // effect: "fade", // autoplay: { // delay: 3000, // stopOnLastSlide: false, // disableOnInteraction: false, // }, autoplay: false, pagination: { el: ".swiper-pagination", clickable: true, }, navigation: { nextEl: ".banner-swiper-button-next", prevEl: ".banner-swiper-button-prev", }, }); } // 专家轮播 function createExpertSwiperInstance(clientWidth) { var slidesPerView = clientWidth > 1366 ? 5 : clientWidth >= 800 ? 3 : 2; var spaceBetween = clientWidth > 1366 ? 20 : clientWidth >= 800 ? 15 : 10; return new Swiper(".expert-container", { loop: false, effect: "slide", slidesPerView: slidesPerView, centeredSlides: false, spaceBetween: spaceBetween, calculateHeight:true, observer: true, autoplay: { delay: 3000, stopOnLastSlide: false, disableOnInteraction: true, }, pagination: { el: ".swiper-pagination", dynamicBullets: true, }, watchSlidesProgress: true, watchSlidesVisibility: true, }); } function toDetails(articleId) { window.location.href='/article/details/'+articleId; } // 初始化地图 function initMap() { var language = languageD.language.toLowerCase() var lat = "108.818785"; var lng = "34.241859"; var map = new AMap.Map("map-container", { zoom: 14, cityName: "西安", lang: language, // 语言 center: [lat, lng], resizeEnable: true, // 是否监控地图容器尺寸变化 mapStyle: "amap://styles/macaron", // 主题 }); map.plugin("AMap.ToolBar", function () { var toolbar = new AMap.ToolBar(); map.addControl(toolbar); }); var marker = new AMap.Marker({ position: map.getCenter(), icon: "//webapi.amap.com/theme/v1.3/markers/n/mark_b.png", // 设置是否可以拖拽 draggable: false, cursor: "move", }); marker.setMap(map); return map; }