/* * @Author: Chenzy * @Date: 2017-12-07 09:23:26 * @Last Modified by: Chenzy * @Last Modified time: 2018-05-24 16:47:12 */ $(function () { // PC banner $("#Banner").owlCarousel({ autoPlay: true, navigation: false, singleItem: true, stopOnHover: true, transitionStyle: 'fadeUp', }); // 手机banner $("#BannerM").owlCarousel({ autoPlay: true, navigation: false, singleItem: true, stopOnHover: true, transitionStyle: 'fadeUp', }); $('#us-link').on('click', function () { $('.left-box').toggleClass('current'); return false; }) $(document).on('click', function () { if ($('.left-box').hasClass('current')) { $('.left-box').removeClass('current'); } }) // 导航宽度 $('.nav').each(function () { var items = $('.nav>li'); var num = items.size() if (num > 5 && num < 10) { $(this).addClass('nav-num-' + num); } }) // 手机导航 $(document).ready(function () { $('#sideMenu').sideToggle({ moving: '#sideMenuContainer', direction: 'right' }); }); (function ($) { $.fn.sideToggle = function (options) { var settings = $.extend({ moving: null, // which object to toggle? direction: null // toggle from this side of the window }, options); return this.click(function () { var thisDir = {}; var moveThis = settings.moving; var dirPos = parseInt($(moveThis).css(settings.direction), 10); var menuWidth = $(moveThis).outerWidth(); if (isNaN(dirPos)) { console.log("Please define the object's position in the css."); } if (dirPos === 0) { thisDir[settings.direction] = -menuWidth; $(moveThis).animate(thisDir); } else { thisDir[settings.direction] = 0; $(moveThis).animate(thisDir); } }); } }(jQuery)); // 首页主营产品 $(document).ready(function () { $("#owl-demo").owlCarousel({ items: 5, autoPlay: true, lazyLoad: true, }); }); $(document).ready(function () { $("#owl-demo1").owlCarousel({ items: 5, autoPlay: true, lazyLoad: true, }); }); $(document).ready(function () { $("#owl-demo2").owlCarousel({ items: 5, autoPlay: true, lazyLoad: true, }); }); //选项卡 $('.m-i-img .container').each(function () { var oItem = $(this).find('.pro-nlist li'); var oList = $(this).find('.wrap .pro-chlist'); oItem.eq(0).addClass('click'); oList.eq(0).show(); oItem.bind('touchstart click', function () { $(this).addClass('click').siblings().removeClass('click'); oList.hide(); oList.eq($(this).index()).show(); }) }) // 企业图集放大 $('#zoomBtn').click(function () { var oUrl = $(this).data('img'); $('.m-modal').addClass('m-modal-on'); $('#mcPic').attr('src', oUrl); }); $('#closeBtn, #maskBg').click(function () { $('.m-modal').removeClass('m-modal-on'); }); // 客服组件 $('.m-consultant').each(function () { var self = $(this); var btnOpen = self.find('#kfUnfold'); var btnClose = self.find('#kfShrink'); var oGroup = self.find('.group'); var oWrap = self.find('.wrap'); var oWidth = oWrap.outerWidth(); btnOpen.click(function () { oGroup.hide(); self.animate({ 'right': 0 }, 0) }); btnClose.click(function () { oGroup.fadeIn(); self.animate({ 'right': -oWidth + 'px' }, 0) }); }); $.backTop($('#backTop')); }); // 图片懒加载 $(function() { $("img.lazy").lazyload({ effect : "fadeIn" }); }); function baidumap(){ // 百度地图API功能 var map = new BMap.Map('allmap'); var poi = new BMap.Point(122.054246,37.428462); map.centerAndZoom(poi, 16); map.enableScrollWheelZoom(); var content = '
地址:威海市环翠区羊亭镇羊亭村南一街2号
电话:13061173293
'; //创建检索信息窗口对象 var searchInfoWindow = null; searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, { title: "威海环宇化工机械有限公司", //标题 width: 290, //宽度 height: 105, //高度 panel: "panel", //检索结果面板 enableAutoPan: true, //自动平移 searchTypes: [ BMAPLIB_TAB_SEARCH, //周边检索 BMAPLIB_TAB_TO_HERE, //到这里去 BMAPLIB_TAB_FROM_HERE //从这里出发 ] }); var marker = new BMap.Marker(poi); //创建marker对象 marker.enableDragging(); //marker可拖拽 searchInfoWindow.open(marker); map.addOverlay(marker); //在地图中添加marker } /* * 返回顶部方法-Czy * param [element] "string = $('')" 元素 * param [speed] "int = 500" 返回顶部时间 ms * param [invisible] "boolen = true" 元素默认隐藏 * param [opacity] "int = 500" 显示隐藏时间 ms */ $.backTop = function (element, speed, invisible, opacity) { var $oEle = element; (speed === undefined) ? speed = 500: speed = speed; (invisible === undefined) ? invisible = true: invisible = invisible; (opacity === undefined) ? opacity = 0: opacity = opacity; if (invisible) { var oWin = $(window); var oDoc = $(document); $oEle.hide(); oWin.scroll(function () { if (oDoc.scrollTop() > 1) { $oEle.fadeIn(opacity); } else { $oEle.fadeOut(opacity); } }) } $oEle.click(function () { $('html, body').stop().animate({ scrollTop: 0 }, speed); return false; }) } /*咨询*/ $(function() { var listPanel = $('.ap-main ul'); var nubcers = 0; //向上滚动top值 function up() { //向上滚动 listPanel.animate({ //中奖结果 'top': (nubcers - 35) + 'px' }, 1500, 'linear', function() { listPanel.css({ 'top': '0px' }) .find("li:first").appendTo(listPanel); up(); }); } up(); });