(function(a) { if (typeof define === "function" && define.amd) { define(["jquery"], a); } else { a(jQuery); } }(function(a) { a.fn.addBack = a.fn.addBack || a.fn.andSelf; a.fn.extend({ actual: function(b, l) { if (!this[b]) { throw '$.actual => The jQuery method "' + b + '" you called does not exist'; } var f = { absolute: false, clone: false, includeMargin: false, display: "block" }; var i = a.extend(f, l); var e = this.eq(0); var h, j; if (i.clone === true) { h = function() { var m = "position: absolute !important; top: -1000 !important; "; e = e.clone().attr("style", m).appendTo("body"); }; j = function() { e.remove(); }; } else { var g = []; var d = ""; var c; h = function() { c = e.parents().addBack().filter(":hidden"); d += "visibility: hidden !important; display: " + i.display + " !important; "; if (i.absolute === true) { d += "position: absolute !important; "; } c.each(function() { var m = a(this); var n = m.attr("style"); g.push(n); m.attr("style", n ? n + ";" + d : d); }); }; j = function() { c.each(function(m) { var o = a(this); var n = g[m]; if (n === undefined) { o.removeAttr("style"); } else { o.attr("style", n); } }); }; } h(); var k = /(outer)/.test(b) ? e[b](i.includeMargin) : e[b](); j(); return k; } }); }));; (function($, window, document) { "use strict"; var defaults = { deVal: 0, className: 'dataNums', digit: '' }; function rollNum(obj, options) { this.obj = obj; this.options = $.extend(defaults, options); this.init = function() { this.initHtml(obj, defaults); } } rollNum.prototype = { initHtml: function(obj, options) { var strHtml = '
'; var valLen = options.digit || (options.deVal + '').length; if (obj.find('.' + options.className).length <= 0) { for (var i = 0; i < valLen; i++) { strHtml += '
0 1 2 3 45 6 7 8 90 1 2 3 45 6 7 8 9
'; } strHtml += '
'; obj.html(strHtml); } this.scroNum(obj, options); }, scroNum: function(obj, options) { var number = options.deVal; var $num_item = $(obj).find('.' + options.className).find('.tt'); var h = $(obj).find('.dataBoc').height(); $num_item.css('transition', 'all 2s ease-in-out'); var numberStr = number.toString(); if (numberStr.length <= $num_item.length - 1) { var tempStr = ''; for (var a = 0; a < $num_item.length - numberStr.length; a++) { tempStr += '0'; } numberStr = tempStr + numberStr; } var numberArr = numberStr.split(''); $num_item.each(function(i, item) { setTimeout(function() { $num_item.eq(i).css('top', -parseInt(numberArr[i]) * h - h * 10 + 'px'); }, i * 100) }); } } $.fn.rollNum = function(options) { var $that = this; var rollNumObj = new rollNum($that, options); rollNumObj.init(); }; })(jQuery, window, document); window.onresize = function() { AOS.refresh(); } var _media={}; function _slick(id, pc_stype, pc_slidesToShow, pc_slidesToScroll, pc_dots, pc_arrows, wap_stype, wap_slidesToShow, wap_slidesToScroll, wap_dots, wap_arrows, infinite, autoplay, autoplaySpeed,pc_vertical,wap_vertical) { // 展示方式一致,都是幻灯片 if (pc_stype == wap_stype && pc_stype == 1) { $(id + " .slick").each(function () { $(this).find("ul").eq(0).removeClass("slick-list"); $(this).find("ul").slick({ dots: pc_dots == 1, arrows: pc_arrows == 1, infinite: infinite == 1, autoplay: autoplay == 1, vertical: pc_vertical == 1, autoplaySpeed: autoplaySpeed, slidesToShow: pc_slidesToShow, slidesToScroll: pc_slidesToScroll, lazyLoad: 'progressive', responsive: [{ breakpoint: _media[id], settings: { dots: wap_dots == 1, arrows: wap_arrows == 1, vertical: wap_vertical == 1, slidesToShow: wap_slidesToShow, slidesToScroll: wap_slidesToScroll } }] }); }); } //其中一端是幻灯片 else if (pc_stype == 1 || wap_stype == 1) { $(id + " .slick").each(function () { //拷贝移动端dom,设置PC时隐藏 $(this).find("ul").clone().appendTo($(this)); // 设置PC端dom移动端隐藏 $(this).find("ul").eq(0).addClass("hidden-"+ _media[id]); $(this).find("ul").eq(1).addClass("visible-"+ _media[id]); if (pc_stype == 1) { //PC端是幻灯片 // 移动端是平铺,设置平铺样式 $(this).find("ul").eq(0).removeClass("slick-list"); //PC端绑定幻灯片效果 $(this).find("ul").eq(0).slick({ dots: pc_dots == 1, arrows: pc_arrows == 1, infinite: infinite == 1, autoplay: autoplay == 1, vertical: pc_vertical == 1, autoplaySpeed: autoplaySpeed, slidesToShow: pc_slidesToShow, slidesToScroll: pc_slidesToScroll, lazyLoad: 'progressive' }); } else { //移动端是幻灯片 // PC端是平铺,设置平铺样式 $(this).find("ul").eq(1).removeClass("slick-list"); // 移动端绑定幻灯片 $(this).find("ul").eq(1).slick({ dots: wap_dots == 1, arrows: wap_arrows == 1, autoplay: infinite == 1, infinite: autoplay == 1, vertical: wap_vertical == 1, autoplaySpeed: autoplaySpeed, slidesToShow: wap_slidesToShow, slidesToScroll: wap_slidesToScroll, lazyLoad: 'progressive' }); } }) } } function _baidumap() { if ($('._mapbox').length > 0) { if (window.TILE_VERSION == undefined) { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = "http://api.map.baidu.com/getscript?v=2.0&ak=PGgBx2t0wST5E8OI3dmIYVrzLkurz1BW&services=&t=20140825185308"; document.getElementsByTagName('head')[0].appendChild(script); } for (var i = 0; i < $('._mapbox').length; i++) { $('._mapbox').eq(i).attr('id', "_mapcontent" + i); var style = document.createElement('style'); if ($('._mapbox').eq(i).find('style').length > 0) { style.innerHTML = $('._mapbox').eq(i).find('style').html().split('.').join("\r\n#_mapcontent" + i + " ."); document.getElementsByTagName('head')[0].appendChild(style); } _loadmap(i) } } } function pageInit() { AOS.init({ offset: 0, duration: 700, easing: 'ease-in-sine', delay: 50, disable:window.innerWidth < 1024 }); _baidumap(); //console.log('pageinit') } function _onscroll(scrollTop) { if(window.innerWidth < 1024) { return; } $("._nav_event").each(function() { var config = $(this).attr("_data").split(','); if (config.length == 2 && config[1] != "0") { if (config[1] == "1") { if (scrollTop >= config[0] * 1) $(this).hide(); else $(this).show(); } else if (config[1] == "2") { if (scrollTop >= config[0] * 1) $(this).show(); else $(this).hide(); } else if (config[1] == "3") { if (scrollTop >= config[0] * 1) { $(this).css({ "position": "fixed", "z-index": "15", "top": "0" }) } else $(this).removeAttr("style"); } } else if (config.length == 3 && config[2] != "0") { if (config[0] == "0") { if (config[2] == "1") { if (scrollTop >= config[1] * 1) $(this).hide(); else $(this).show(); } else if (config[2] == "2") { if (scrollTop >= config[1] * 1) $(this).show(); else $(this).hide(); } } else if (config[0] == "1") { var scrollbottom=$(document).height()-scrollTop-$(window).height(); if (config[2] == "1") { if (scrollbottom < config[1] * 1) $(this).hide(); else $(this).show(); } else if (config[2] == "2") { if (scrollbottom < config[1] * 1) $(this).show(); else $(this).hide(); } } } }); } $(window).on('scroll', function() { _onscroll($(document).scrollTop()); }); function _popup(_this) { if ($('#_popup').length == 0) { $('html').append('
'); } $('#_popup').html('
+
'); $('#_popup ._html_con').html(_this.find('._html').html()).fadeIn(); $('#_popup').fadeIn(); } function _popupFindID(dom) { if (dom.attr("id")) { return dom.attr("id") } else { if (dom.parent()) { return _popupFindID(dom.parent()) } else { return "null"; } } } function _popupHide() { $('#_popup ._html_con').html(''); $('#_popup').fadeOut(); } function _loadmap(id) { if (window.TILE_VERSION) { parameterMap("_mapcontent" + id); $("_mapcontent" + id).removeClass("_mapbox"); } else { window.setTimeout("_loadmap(" + id + ")", 1000); } } //获取参数并初始化地图 function parameterMap(mapid) { var _map = $("#" + mapid); var _coordinate = _map.attr('data-coordinate').split(','); //坐标 var _level = "17"; //级别 if (_map.attr('data-level')) { _level = _map.attr('data-level'); } var _icon = "icon-1.png"; //图标 var _icon_w = 19; //图标宽度 var _icon_h = 25; //图标高度 if (_map.attr('data-icon')) { _icon = _map.attr('data-icon'); _icon_w = _map.attr('data-icon-w'); _icon_h = _map.attr('data-icon-h'); } var _tit = ""; //标题 if (_map.find('.mapTit').length > 0) { _tit = _map.find('.mapTit').html(); } var _intro = ""; //内容 if (_map.find('.mapIntro').length > 0) { _intro = _map.find('.mapIntro').html(); } var _style = "normal"; //样式 if (_map.attr('data-style')) { _style = _map.attr('data-style'); } var _open = 0; //弹窗默认关闭 if (_map.attr('data-open')) { _open = _map.attr('data-open'); } initMap(mapid, _tit, _intro, _coordinate, _open, _icon, _icon_w, _icon_h, _level, _style); //创建和初始化地图 } //创建和初始化地图函数: function initMap(mapid, _tit, _intro, _coordinate, _open, _icon, _icon_w, _icon_h, _level, _style) { createMap(mapid, _coordinate, _level, _style); //创建地图 setMapEvent(); //设置地图事件 addMapControl(); //向地图添加控件 //标注点数组 var markerArr = [{ title: _tit, content: _intro, point: _coordinate[0] + "," + _coordinate[1], isOpen: _open, icon: { w: _icon_w, h: _icon_h, l: 0, t: 0, x: 6, lb: 5 } }]; addMarker(markerArr, _icon); //向地图中添加marker } //创建地图函数: function createMap(mapid, _coordinate, _level, _style) { var map = new BMap.Map(mapid); //在百度地图容器中创建一个地图 var point = new BMap.Point(_coordinate[0], _coordinate[1]); //定义一个中心点坐标 map.setMaxZoom(18) map.centerAndZoom(point, _level); //设定地图的中心点和坐标并将地图显示在地图容器中 window.map = map; //将map变量存储在全局 var mapStyle = { //features: ["road", "building", "water", "land"],//隐藏地图上的poi style: _style //设置地图风格为高端黑 } map.setMapStyle(mapStyle); } //地图事件设置函数: function setMapEvent() { map.enableDragging(); //启用地图拖拽事件,默认启用(可不写) map.enableScrollWheelZoom(); //启用地图滚轮放大缩小 map.enableDoubleClickZoom(); //启用鼠标双击放大,默认启用(可不写) map.enableKeyboard(); //启用键盘上下左右键移动地图 } //地图控件添加函数: function addMapControl() { //向地图中添加缩放控件 var ctrl_nav = new BMap.NavigationControl({ anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_LARGE }); map.addControl(ctrl_nav); //向地图中添加缩略图控件 var ctrl_ove = new BMap.OverviewMapControl({ anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 0 }); map.addControl(ctrl_ove); //向地图中添加比例尺控件 var ctrl_sca = new BMap.ScaleControl({ anchor: BMAP_ANCHOR_BOTTOM_LEFT }); map.addControl(ctrl_sca); } //创建marker function addMarker(markerArr, _icon) { for (var i = 0; i < markerArr.length; i++) { var json = markerArr[i]; var p0 = json.point.split(",")[0]; var p1 = json.point.split(",")[1]; var point = new BMap.Point(p0, p1); var iconImg = createIcon(json.icon, _icon); var marker = new BMap.Marker(point, { icon: iconImg }); var iw = createInfoWindow(i, markerArr); var label = new BMap.Label(json.title, { "offset": new BMap.Size(json.icon.lb - json.icon.x + 10, -20) }); marker.setLabel(label); map.addOverlay(marker); label.setStyle({ borderColor: "#808080", color: "#333", cursor: "pointer" }); (function() { var index = i; var _iw = createInfoWindow(i, markerArr); var _marker = marker; _marker.addEventListener("click", function() { this.openInfoWindow(_iw); }); _iw.addEventListener("open", function() { _marker.getLabel().hide(); }) _iw.addEventListener("close", function() { _marker.getLabel().show(); }) label.addEventListener("click", function() { _marker.openInfoWindow(_iw); }) if (json.isOpen == 1) { if (json.title.length > 0) { label.hide(); } else { label.remove(); } _marker.openInfoWindow(_iw); } })() } } //创建InfoWindow function createInfoWindow(i, markerArr) { var json = markerArr[i]; var iw = new BMap.InfoWindow("" + json.title + "
" + json.content + "
"); return iw; } //创建一个Icon function createIcon(json, _icon) { var icon = new BMap.Icon(_icon, new BMap.Size(json.w, json.h), { imageOffset: new BMap.Size(-json.l, -json.t), infoWindowOffset: new BMap.Size(json.lb + 5, 1), offset: new BMap.Size(json.x, json.h) }) return icon; }