$(function () { wowInt(); findTel(); phoneTargetSelf(); nav(); search(); public_ajax(); select(); invest03(); $(document).on("click",".ll_re dl dt",function(e){ e.preventDefault(); e.stopPropagation(); $(this).siblings().slideToggle(); }) $(document).click(function(){ $(".ll_re dl dd").slideUp(); }) //顶部悬浮 $(window).scroll(function(){ if($(window).scrollTop()>0){ $("body").addClass("scroll-header"); }else{ $("body").removeClass("scroll-header"); } }) if($(window).width()>767){ var h_max = 0; $('.conn-part02 li').each(function() { var h = $(this).height(); h_max = h > h_max ? h : h_max; }); $('.conn-part02 li').height(h_max); } var src = $(".summary_l").find("img").attr("src"); if(src=="../images/error.png"){ $(".summary_l").hide(); } else{ //console.log(1) } //手机端底部 if($(window).width()<769){ $(".foot_top li").map(function(){ if($(this).children(".con").length>0){ $(this).addClass("has_con"); } }) $(document).on('click','.foot_top li.has_con h2',function(){ $(this).parent("li").siblings().removeClass("on"); $(this).parent("li").siblings().find(".con").slideUp(); $(this).parent("li").toggleClass("on"); $(this).parent("li").find(".con").slideToggle(); }) } //end //公共选项卡 $(".tab-box .tab-a").each(function() { $(this).click(function() { if (!$(this).hasClass("off")) { $(this).addClass("on").siblings().removeClass("on"); var ii=$(this).index(); $(this).parents(".tab-box").find(".tab-b").eq(ii).show().siblings().hide(); $('.counter').countUp({ delay: 10, time: 1000 }); } }); }) $(".tab-box").each(function (i) { $(this).find(".tab-a:eq(0)").click(); }); //end if($(window).width()>767){ $(".news-part01 .rr li").mouseenter(function() { $(this).addClass("on").siblings().removeClass("on"); var ii=$(this).index(); $(this).parents(".news-part01").find(".ll li").eq(ii).show().siblings().hide(); }) $(".news-part01 .rr li:eq(0)").mouseenter(); } else{ news_slide01(); } }) function news_slide01() { var n01Swiper = new Swiper('.news-part01 .swiper-container', { autoplay: false, slidesPerView : 1, spaceBetween : 10, prevButton:'.news-part01 .swiper-button-prev', nextButton:'.news-part01 .swiper-button-next', }) } function invest03(){ var inp03Swiper = new Swiper('.invest-part03 .swiper-container',{ slidesPerView : 3, slidesPerGroup : 1, spaceBetween : 48, prevButton:'.invest-part03 .swiper-button-prev', nextButton:'.invest-part03 .swiper-button-next', breakpoints: { 767: { slidesPerView: 1, spaceBetween: 10 } } }) if($(window).width()>767){ if($(".invest-part03 .swiper-slide").size()<=3){ $(".invest-part03 .swiper-button-prev,.invest-part03 .swiper-button-next").hide(); } } } function select(){ $(".select-box").each(function (i) { $(this).find("dt").click(function (e) { e.preventDefault(); e.stopPropagation(); var el = $(this).parent(".select-box"); if(el.hasClass('open')){ el.removeClass('open'); el.find("dd").stop().slideUp(); }else{ el.addClass('open'); el.find("dd").stop().slideDown(); //el.parents("li").siblings("li").find(".select-box").removeClass('open'); } }) $(".select-box").eq(i).find("dd a").each(function (x) { $(this).click(function () { var inde = $(this).index(); $(this).addClass("on").siblings().removeClass("on"); var el = $(".select-box.open"); el.next(".select-hidden").val($(this).attr("data-val")) el.find("dt a").html($(this).html()); el.find("dd a").eq(inde).addClass("on").siblings().removeClass("on"); setTimeout(function () { el.removeClass("open"); el.find("dd").stop().slideUp(); },1) }) }) }) $(document).click(function () { $(".select-box.open").removeClass("open"); $(".select-box.open").find("dd").stop().slideUp(); }) } function commAjax(str,url){ $.ajax({ url:url, success:function(msg){ $(str).html(""); $(str).append(msg); } }); } //主导航 function nav(){ if($(window).width()>1024){ $(".nav ul>li").hover(function() { $(this).find(".navlist").stop().slideDown(); $(this).find("dl").css("left",$(this).offset().left + 32); //console.log($(this).offset().left) $(".bus_nav .ll p").eq(0).addClass("has_rr"); $(".bus_nav .ll p").eq(1).addClass("has_rr"); $(".bus_nav .ll p").eq(2).addClass("has_rr"); $(".bus_nav .ll p").eq(3).addClass("has_rr"); $(".bus_nav .ll p.has_rr").removeClass("on"); $(".bus_nav .ll p.has_rr").eq(0).addClass("on"); $(".bus_nav ol").hide(); $(".bus_nav ol").eq(0).show(); }, function() { $(this).find(".navlist").stop().slideUp(); }); $(".bus_nav .ll p").hover(function() { $(this).addClass("on").siblings().removeClass("on"); if(!$(this).hasClass("has_rr")){ $(".bus_nav ol").hide(); return false; } else{ var ii =$(this).index(); $(".bus_nav ol").eq(ii).show().siblings().hide(); } }, function() { }); }else{ $(".navlist").siblings("span").addClass("cur"); $(document).on('click','.nav_phone_btn',function(e){ e.preventDefault(); e.stopPropagation(); $('.nav_phone_btn').toggleClass('visible_nav'); $('body').toggleClass('body_nav_phone'); $(".nav_click").show(); }); $(document).on('click','.nav_click',function(){ $('.nav_phone_btn').removeClass('visible_nav'); $('body').removeClass('body_nav_phone'); $(this).hide(); }) $(document).on('click','.nav ul li span',function(e){ $(this).parent("li").siblings().find("span").removeClass("on"); $(this).parent("li").siblings().find(".navlist").slideUp(); $(this).toggleClass("on"); $(this).siblings(".navlist").slideToggle(); }) } } // 地图 function mapInt(mapTitle,mapAdress,mapx,mapy){ var num = 0.001; var map = new BMap.Map("map"); var point = new BMap.Point(mapx+num,mapy); var point2 = new BMap.Point(mapx,mapy); var myIcon = new BMap.Icon("../images/dot09.png", new BMap.Size(27,36));// icon按钮 var marker2 = new BMap.Marker(point2,{icon:myIcon}); // 创建标注 map.addOverlay(marker2); // 将标注添加到地图中 map.centerAndZoom(point, 19); if($(window).width()<1024){ num = 0; map.centerAndZoom(point2, 19); } /*var opts = { width : 200, height: 100, title : "胜利油田大明集团" } var infoWindow = new BMap.InfoWindow("地址:山东省东营市东营区千佛山路20号", opts); // 创建信息窗口对象 marker2.addEventListener("click", function(){ map.openInfoWindow(infoWindow,point2); //开启信息窗口 });*/ map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用 map.enableContinuousZoom(); //启用地图惯性拖拽,默认禁用 } //--------------点击分享 function share(){ /* $(".share_in").click(function () {//linkedin var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "//www.linkedin.com/uas/login?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); }) $(".share_qqkj").click(function () {//腾讯微博 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op) })*/ $(".share_bdtb").click(function () {//百度贴吧 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://tieba.baidu.com/f/commit/share/openShareApi?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); }) $(".share_db").click(function () {//豆瓣 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "https://www.douban.com/share/service?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); }) $(".share_wb").click(function () {//微博 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://service.weibo.com/share/share.php?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op) }) $(".share_qq").click(function () {//QQ var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://connect.qq.com/widget/shareqq/index.html?url=" + encodeURIComponent(url) + ""; window.open(op); }) //微信 $(".share_wx").attr("data-qrcode","http://www.xinhongru.com/qrcode/qrcode.php?content="+window.location.href); //$(".share_wx").attr("data-qrcode", "/qrCode/Index.aspx?url=" + window.location.href); $(".share_wx").click(function () {//微信 //var url = "/qrCode/Index.aspx?url=" + window.location.href; var url = $(this).attr("data-qrcode") console.log(url) var title = "" title += "
" title += "x" title += "

二维码

" title += "
" title += "

扫一扫

" title += "
" $("body").remove(".weixin"); $("body").append(title) }) $(document).on("click", ".weixin .c", function () { $(".weixin").remove(); }) } //搜索 function search(){ $(document).on("click", "span.ser", function (e) { e.preventDefault(); e.stopPropagation(); $(this).toggleClass("on"); $(".search_wrap").toggleClass("on"); }) $(document).on("click", ".search_box_text", function (e) { e.preventDefault(); e.stopPropagation(); }) $(document).click(function(){ $(".search_wrap").removeClass("on"); $("span.ser").removeClass("on"); }) } //public_ajax function public_ajax() { if($(".ajLoad").length>0){ var $resourceTypeList = $('.ajLoad ul'); $resourceTypeList.infinitescroll({ navSelector: "#public_more", nextSelector: "#public_more a", itemSelector: ".public_li", clickb: true, clickobj: ".public_load-more-link", loading: { img: "../images/loading.gif", msgText: ' ', finishedMsg: '', finished: function() { $("#infscr-loading").hide(); imgratio(); } }, errorCallback: function() { $(".public_load-more-link").after("
没有了
"); $(".public_load-more-link").hide(); setTimeout(function () { $(".finMessage").fadeOut(); }, 500) } }, function(newElements) { var $newElems = $(newElements); $newElems.fadeIn(); return; }); } } //wow入场 function wowInt(){ if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){ var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 100, mobile: false, live: true }); wow.init(); }; } /*手机端链接改为本窗口打开*/ function phoneTargetSelf(context){ if ($(window).width()<1024) { if(context==undefined){ context=$(document); } $('a',context).each(function(){ var target=$(this); var link=target.attr('target'); target.attr('target','_self'); }) } } /*电话链接取消默认事件并添加样式*/ function findTel(context){ if ($(window).width()>1024) { var condition = /^tel\:([0-9\-]+)|tel\:\+([0-9\-]+)$/; if(context==undefined){ context=$(document); } $('a',context).each(function(index, el) { var target=$(this); var href=target.attr('href'); if (condition.test(href)) { target.addClass('tel_link'); target.on('click',function(event){ event.preventDefault(); }) } }); } } /*ie9的placeholder包含密码框的兼容*/ $(function(){ if(!placeholderSupport()){ // 判断浏览器是否支持 placeholder $('input').not("input[type='password']").each( function() { var self = $(this); var val = self.attr("placeholder"); input(self, val); /*if($(this).val()=="" && $(this).attr("placeholder")!=""){ $(this).val($(this).attr("placeholder")); $(this).focus(function(){ if($(this).val()==$(this).attr("placeholder")) $(this).val(""); }); $(this).blur(function(){ if($(this).val()=="") $(this).val($(this).attr("placeholder")); }); }*/ } ); $('input[type="password"]').each( function() { var pwdField = $(this); var pwdVal = pwdField.attr('placeholder'); var pwdClass = pwdField.attr('class'); // 重命名该input的id为原id后跟1 pwdField.after(''); var pwdPlaceholder = $(this).siblings('.login-input'); pwdPlaceholder.show(); pwdField.hide(); pwdPlaceholder.focus(function(){ pwdPlaceholder.hide(); pwdField.show(); pwdField.focus(); }); pwdField.blur(function(){ if(pwdField.val() == '') { pwdPlaceholder.show(); pwdField.hide(); } }); } ); }; }) // 判断浏览器是否支持placeholder属性 function placeholderSupport() { return 'placeholder' in document.createElement('input'); } // jQuery替换placeholder的处理 function input(obj, val) { var $input = obj; var val = val; $input.attr({value:val}); $input.focus(function() { if ($input.val() == val) { $(this).attr({value:""}); } }).blur(function() { if ($input.val() == "") { $(this).attr({value:val}); } }); } //end