$(function () { // 轮播 var banner = new Swiper('.banner', { autoplay: true,//可选选项,自动滑动 loop: true, pagination: { el: '.swiper-pagination', clickable: true, }, }) // 新闻资讯滚动 function Roll(ele, time, fun) { var obj = document.getElementById(ele); var ul = obj.children; var li = ul[0].children; console.log(li) if (fun) { var fun = fun; } else { var fun = function () { }; } var t; if (time) { var time = time; } else { var time = 2500; } t = setInterval(function () { fun() $(li).eq(0).slideUp(function () { $(ul).append($(li).eq(0)); }); $(li).show(); }, time); $(ul).on('mouseenter', 'li', function () { clearInterval(t) }) $(ul).on('mouseleave', 'li', function () { t = setInterval(function () { fun() $(li).eq(0).slideUp(function () { $(ul).append($(li).eq(0)); }); $(li).show(); }, time); }) } // Roll('farmBrief', 5000) // Roll('newsListDiv', 2000) // Roll('videoListBox', 5000,function(){ // $('#videoListBox .videoListUl >li').removeClass('active'); // $('#videoListBox .videoListUl >li').eq(1).addClass('active'); // }) // Roll('gardenMsg', 2000, function(){ // $('#gardenMsg .gardenUl >li').removeClass('active'); // $('#gardenMsg .gardenUl >li').eq(1).addClass('active'); // $('.gardenImg >img').attr('src',$('#gardenMsg .gardenUl >.active').find('.hide_farm_img').val()) // }) // var stu = new Roll("newsListDiv", 12); // 视频咨询 var myPlayer = videojs('my-video'); videojs("my-video").ready(function () { var myPlayer = this; myPlayer.play(); }); // 视频咨询 $('#videoListBox').on('click', '.date', function () { $('#videoListBox .videoListUl >li').removeClass('active'); $(this).parent().addClass('active'); var myPlayer = videojs('my-video'); var videoUrl = $(this).find('.hide_video_url').val(); videojs("my-video", {}, function () { window.myPlayer = this; $("#mymoda .video-con #my-video source").attr("src", videoUrl); myPlayer.src(videoUrl); myPlayer.load(videoUrl); myPlayer.play(); }); // $('.videoBox').html(''); $(".video_link").click(function () { var myPlayer = videojs('my-video'); var videoUrl = $(this).find('.hide_video_url').val(); videojs("my-video", {}, function () { window.myPlayer = this; $("#mymoda .video-con #my-video source").attr("src", videoUrl); myPlayer.src(videoUrl); myPlayer.load(videoUrl); myPlayer.play(); }); $(".click-modal").click(); }); // 模态窗消失时,关闭视频 $('#mymoda').on('hidden.bs.modal', function () { myPlayer.pause(); }); }) // 四季采摘 $('#gardenMsg').on('click', '.gardenName', function () { $('#gardenMsg .gardenUl >li').removeClass('active'); $(this).parent().addClass('active'); // $(this).find('.hide_farm_img').val(); $('.gardenImg >img').attr('src', $(this).find('.hide_farm_img').val()) }) // 导游导览 // var map = new AMap.Map('map', { // resizeEnable: true, //是否监控地图容器尺寸变化 // zoom: 11, //初始化地图层级 // center: [113.397428, 39.90923] //初始化地图中心点 // }); //绘制初始路径 // var path = []; // path.push([113.641379, 34.574431]); // path.push([108.877908, 34.389461]); // path.push([108.350564, 22.847832]); // map.plugin("AMap.DragRoute", function () { // route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE); //构造拖拽导航类 // route.search(); //查询导航路径并开启拖拽导航 // }); // 民宿导览 var swiper = new Swiper('.homestay', { slidesPerView: 3, spaceBetween: 30, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, autoplay: { delay: 3000 }, }); }) var map = new AMap.Map('map', { resizeEnable: true, //是否监控地图容器尺寸变化 zoom: 11, //初始化地图层级 center: [113.397428, 39.90923] //初始化地图中心点 }); // var geoc = new AMap.Geocoder(); function searchWay() { clearWay() var startPath = $("#startPath").val(); var endPath = $("#endPath").val(); if (!startPath) { $("#startPath").focus(); return; } if (!endPath) { $("#endPath").focus(); return; } $('.guideMap').append('
