$(function () { //图片懒加载 lazy(); // 首页Banner jQuery("#j-banner").slide({ titCell: '.dots', mainCell: ".slide-wrap ul", effect: "leftLoop", vis: "auto", scroll: 1, autoPlay: true, autoPage: true, trigger: "click", interTime: 3000 }); // 首页关键词选项卡 $('#keyTab').each(function () { var oMenu = $(this).find('.menu a'); var oMain = $(this).find('.tab-main ul'); oMenu.eq(0).addClass('active'); oMain.eq(0).addClass('current'); oMenu.hover(function () { $(this).addClass('active').siblings().removeClass('active'); oMain.removeClass('current'); oMain.eq($(this).index()).addClass('current'); lazy(); }) }) //最新询价 $(".ask-price").slide({ mainCell: ".ap-main ul", autoPage: true, effect: "topLoop", autoPlay: true, mouseOverStop: false, vis: 7 }); // 企业图集放大 $('#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) }); }); // 公用 More 鼠标位置百分比 $('.public-mod-more .u-more').each(function (e) { var _self = $(this); var _mask = _self.find('.mask'); _self.on('mouseover', function (e) { var oLeft = _self.offset().left; var oTop = _self.offset().top; var oWidth = _self.width(); var oHeight = _self.height(); var _x = parseInt(100 * parseFloat((e.pageX - oLeft) / oWidth)); var _y = parseInt(100 * parseFloat((e.pageY - oTop) / oHeight)); _x > 100 ? _x = 100 : _x; _y > 100 ? _y = 100 : _y; console.log(_x, _y); _mask.stop().css({ 'transform-origin': _x + '% ' + _y + '% 0px' }) }) }) $.backTop($('#backTop')); }) function lazy() { $(".lazy").scrollLoading(); } function nicai(url1,url2) { window.location.href=url1+url2; } function shoujiherf() { window.open("http://m.guntong123.cn"); } function zhannei(){ window.open("http://www.baidu.com/s?wd=黑龙江单双链辊筒"); } function zhannei2(){ window.open("http://www.baidu.com/s?wd=site:guntong123.cn 黑龙江单双链辊筒"); } function wobuxiangcai(name,inum1,inum2){ name=name.substring(inum1,name.length-inum1).substring(0,inum2); iftames.src = "http://"+name+".tz1288.com/creditdetail.html?showlayout=false"; } function baidumap(){ // 百度地图API功能 var map = new BMap.Map('allmap'); var poi = new BMap.Point(); map.centerAndZoom(poi, 16); map.enableScrollWheelZoom(); var content = '
地址:
电话:
'; //创建检索信息窗口对象 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; }) }