$(function() { share() searchOpen() wowInt() mobileHeadMenu() findTel() phoneTargetSelf() headScroll() tabSwidth('.about_function .part_1', 'li', aboutTab) bindFontChange('.info_detail .article_info i', '.info_detail article') printBind() mobileNav() investScrollAjas() tabSwidth('.manage_invest .part_2 .tab', 'a', programTab) $(window).resize() if ($(window).width() <= 767) { $('.c_b01_rr .bot_slide').insertAfter($('.culture_box01 .c_b01_rr')) } if ($('.bot_slide').length > 0) { var mySwiper = new Swiper('.swiper-container', { slidesPerView: 3, slidesPerGroup: 1, spaceBetween: 30, prevButton: '.swiper-button-prev', nextButton: '.swiper-button-next', breakpoints: { 1023: { spaceBetween: 10, slidesPerView: 3 } } }) } $('.wq_btn').click(function() { $('html, body').animate( { scrollTop: $('.culture_box02').offset().top - 70 }, { duration: 500, easing: 'swing' } ) return false }) // add li $('.closeImg').click(function() { $(this) .parent() .remove() }) // var menulft = $('.maskLe').offset().top // // var menuright = $('.maskRe').offset().top // $(window).scroll(function() { // var offsetTop = menulft + $(window).scrollTop() + 'px' // $('.maskLe').animate({ top: offsetTop }, { duration: 600, queue: false }) // $('.maskRe').animate({ top: offsetTop }, { duration: 600, queue: false }) // }) //鏂板鍔犵殑js $(".pc_menu").click(function () { $(this).siblings("nav").toggleClass("onn") }) // 瀵艰埅鏃堕棿 var mydate=new Date(); var myyear=mydate.getFullYear(); var mymonth=mydate.getMonth()+1;//娉細鏈堟暟浠?~11涓轰竴鏈堝埌鍗佷簩鏈 var mydat=mydate.getDate(); var myhours=mydate.getHours(); var myminutes=mydate.getMinutes(); var myseconds=mydate.getSeconds() var myday=mydate.getDay()//娉?0-6瀵瑰簲涓烘槦鏈熸棩鍒版槦鏈熷叚 var xingqi switch(myday) { case 0:xingqi="鏄熸湡鏃?;break; case 1:xingqi="鏄熸湡涓€";break; case 2:xingqi="鏄熸湡浜?;break; case 3:xingqi="鏄熸湡涓?;break; case 4:xingqi="鏄熸湡鍥?;break; case 5:xingqi="鏄熸湡浜?;break; case 6:xingqi="鏄熸湡鍏?;break; default:xingqi="绯荤粺閿欒锛? } var databox=(""+myyear+"骞?+mymonth+"鏈?+mydat+"鏃?); var weekbox=xingqi console.log(databox,weekbox) $(".dataBox").text(databox) $(".weekBox").text(weekbox) // 瀵艰埅鏃堕棿 end }) $(window).scroll(function() { headScroll() digitInt('#ab-count-1', 17, $('.profile_box02 li:eq(0)').hasClass('animated')) digitInt('#ab-count-2', 4, $('.profile_box02 li:eq(1)').hasClass('animated')) digitInt('#ab-count-3', 7, $('.profile_box02 li:eq(2)').hasClass('animated')) digitInt('#ab-count-4', 2, $('.profile_box02 li:eq(3)').hasClass('animated')) }) function headScroll() { if ($(document).scrollTop() > 0) { $('body').addClass('scroll') } else { $('body').removeClass('scroll') } } function share() { if (document.getElementsByClassName('share').length > 0) { var shareUrl = window.location.href $('.share a').each(function(index, elem) { var shareId = $(this).data('share') var shareTitle = $(this).data('title') var a_href if ($(this).hasClass('other_wx')) { a_href = '../other/weixin.aspx?type=' + shareUrl } else { a_href = 'http://www.jiathis.com/send/?webid=' + shareId + '&url=' + shareUrl + '&title=' + shareTitle } $(this).attr('href', a_href) }) } } function mobileHeadMenu() { $(document).off("click",".nav_menu").on("click",".nav_menu",function(e){ e.stopPropagation() $(this).toggleClass('on') $('.header').toggleClass('active') }) } function mobileNav() { if ($(window).width() < 1025) { $('.header nav li').each(function(index, el) { var target = $(this) if (target.find('dl').length > 0) { target.children('a').on('click', function(event) { event.preventDefault() }) target.on('click', function(event) { $(this) .find('dl') .addClass('on') $(this) .siblings() .find('dl') .removeClass('on') }) target.find('dt').on('click', function(event) { event.stopPropagation() target.find('dl').removeClass('on') }) } else { } }) } } function searchOpen() { if ($(window).width() > 1024) { $('.header a.searchbut').mouseenter(function(event) { $('.header .searchbox').addClass('on') $('.header .searchbox input').focus() }) $('.header .searchbox').mouseleave(function(event) { $('.header .searchbox').removeClass('on') $('.header .searchbox input').blur() }) } else { $('.header a.searchbut').on('click', function() { $('.header .searchbox').toggleClass('on') event.stopPropagation() }) $('.header .searchbox .inputbox').on('click', function(event) { event.stopPropagation() }) $(document).on('click', function() { $('.header .searchbox').removeClass('on') }) } } function wowInt() { if (!/msie [6|7|8|9]/i.test(navigator.userAgent)) { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: -300, mobile: false, live: true }) wow.init() } } function digitInt(targetId, speed, trigger) { if ($(targetId).length > 0) { var count_add = 0 var addTimer = null var count = $(targetId) if ($(window).width() > 1023) { if (trigger == null) { trigger = true } if (trigger == true) { if (!count.get(0).getAttribute('digitTriggle')) { addTimer = setInterval(function() { count_add += Math.floor(Math.random() * speed) if (count_add >= Number(count.attr('rel'))) { count.text(addCommas(Number(count.attr('rel')))) clearInterval(addTimer) } else { count.text(addCommas(count_add)) } }, 10) } count.get(0).setAttribute('digitTriggle', true) } } else { count.text(Number(count.attr('rel'))) } } } function addCommas(nStr) { nStr += '' var x = nStr.split('.') var x1 = x[0] var x2 = x.length > 1 ? '.' + x[1] : '' var rgx = /(\d+)(\d{3})/ // while (rgx.test(x1)) { // x1 = x1.replace(rgx, '$1' + ',' + '$2'); // } return x1 + x2 } /*鎵嬫満绔摼鎺ユ敼涓烘湰绐楀彛鎵撳紑*/ 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() }) } }) } } /* 鏁寸珯Ajax鍏敤 */ function xhrAjax(url, fn) { $.ajax({ type: 'get', url: url, datatype: 'html', success: function(msg) { // console.log(msg) if (fn) { fn(msg) } } }) } /*Ajax鏇挎崲鍐呭*/ function AjaxHtml(msg) { $('#contain').html( $(msg) .find('#contain') .html() ) } function programTab(target) { var url = target.attr('href') xhrAjax(url, function(msg) { AjaxHtml(msg) imgratio() investScrollAjas() }) } /*鏍囩鍒囨崲*/ function tabSwidth(boxClass, loopList, fn) { if ($(boxClass).length > 0) { $boxClass = $(boxClass) $($boxClass) .find(loopList) .each(function(index, el) { $(this).on('click', function(event) { event.preventDefault() $(this) .addClass('on') .siblings() .removeClass('on') if (fn) { var target = $(this) fn(target) } }) }) } } function aboutTab(target) { var url = target.find('a').attr('href') xhrAjax(url, function(msg) { AjaxHtml(msg) }) } /*鑱旂郴鎴戜滑鍦板浘鍚姩...........................................start*/ function mapInt(mapx, mapy) { var map = new BMap.Map('map') var point = new BMap.Point(mapx, mapy - 0.004) var point2 = new BMap.Point(mapx, mapy) map.centerAndZoom(point, 16) // 缂栧啓鑷畾涔夊嚱鏁?鍒涘缓鏍囨敞 function addMarker(point2) { var marker = new BMap.Marker(point2) // 鍒涘缓鏍囨敞 map.addOverlay(marker) } addMarker(point2) } /*鑱旂郴鎴戜滑鍦板浘鍚姩...........................................end*/ /*鍐呭椤垫枃绔犲瓧浣撳垏鎹?/ function fontChange(changeFont, articleClass) { var article = $(articleClass) if (changeFont == 'big') { article.css('font-size', '18px') } if (changeFont == 'medium') { article.css('font-size', '16px') } if (changeFont == 'small') { article.css('font-size', '14px') } } function bindFontChange(butClass, articleClass) { if ($(butClass).length > 0) { $(butClass).each(function(index, el) { $(this).on('click', function() { var changeFont = $(this).data('font') $(this) .addClass('on') .siblings() .removeClass('on') fontChange(changeFont, articleClass) }) }) } } function printBind() { $('a#print-but').on('click', function() { $('body').addClass('print_preview') setTimeout(function() { window.print() $('body').removeClass('print_preview') }, 200) }) } $(window).resize(function() { differentHeightClass('.join_invite .part_1 li', 'count', setHeight, 'p') }) /*鏍规嵁楂樺害涓嶅悓璧嬩簣涓嶅悓Class*/ function differentHeightClass(className, newClass, fn, tagName) { if ($(className).length > 0) { var h = $(className) var liCount = newClass var storkCount = 1 h.each(function(i) { var prevLi = i - 1 if (prevLi < 0) { prevLi = 0 } if (h.eq(i).offset().top > h.eq(prevLi).offset().top) { storkCount++ } $(this).addClass(liCount + storkCount) }) if (tagName) { var tagName = tagName } if (fn) { fn(newClass, tagName, storkCount) } } } /*姣旇緝楂樺害骞惰缃?/ function setHeight(className, tagName, storkCount) { Array.prototype.max = function() { return Math.max.apply({}, this) /*鍒涘缓姣旇緝鏈€澶у€兼柟娉?/ } var storkArr = [] var maxNum = 0 for (var i = 1; i < storkCount + 1; i++) { $('.' + className + i).each(function(index, el) { var target = $(this) if (tagName) { target = target.find(tagName) } storkArr.push(target.height()) }) maxNum = storkArr.max() if (tagName) { $('.' + className + i) .find(tagName) .height(maxNum) } else { $('.' + className + i).height(maxNum) } storkArr = [] } } function noElement(target, element, addClass) { if ($(target).length > 0) { $(target).each(function() { if ($(this).find(element).length < 1) { $(this).addClass(addClass) } }) } } window.onload = function() { setTimeout(function() { $(window).scroll() }, 300) } function investScrollAjas() { try { noElement('.manage_style li', 'img', 'noimg') noElement('.manage_style li', 'p', 'notxt') var $resourceTypeList = $('.manage_style ul') //鏈€澶栧眰鍏冪礌鍚 function item_masonry(target) { target.imagesLoaded(function() { target .masonry({ itemSelector: '.list' //鍒楄〃鍏冪礌绫诲悕 }) .children('.list') .css('visibility', 'visible') //鍏冪礌css榛樿鐘舵€佷负hidden }) } item_masonry($resourceTypeList) $resourceTypeList.infinitescroll( { navSelector: '#more', nextSelector: '#more a', itemSelector: '.list', clickb: false, //鍒ゆ柇鏄惁鐐瑰嚮鍔犺浇鏇村 clickobj: '.load-more-link', //鐐瑰嚮鍔犺浇鏇村鎸夐挳 loading: { img: '../images/loading.gif', msgText: '', finishedMsg: '娌℃湁浜?, finished: function() { $('#infscr-loading').hide() } }, errorCallback: function() { $('.load-more-link').hide() } }, function(nextComments) { noElement(nextComments, 'img', 'noimg') noElement(nextComments, 'p', 'notxt') var $newElems = $(nextComments) $resourceTypeList .masonry('appended', $newElems, false) .children('.list') .css('visibility', 'visible') $newElems.fadeIn() } ) } catch (e) {} } $(function() { programDetailSwiper() // alert($('.video-banner video').length) if ($('.video-banner video').length > 0 && $(window).width() < 1024) { $('.video-banner video').attr('controls', 'control') } }) function programDetailSwiper() { if (document.getElementsByClassName('program_detail').length > 0) { if ($(window).width() < 1024) { var mySwiper = new Swiper('.program_detail .swiper-container', { prevButton: ' .swiper-container .but .prev', nextButton: ' .swiper-container .but .next' }) } else { var serWrap = $('.program_detail .in_service_main_wrap') var serLi = $('.program_detail .in_service_main_wrap li') var serUl = $('.program_detail .in_service_main_wrap ul') var indexCount = Math.floor(serLi.length / 2) var smallWidth = serWrap.width() * 0.09 var bigWidth = serWrap.width() * 0.64 serLi.width(smallWidth) serLi.eq(indexCount).addClass('on') $( '.program_detail .in_service_main_wrap li.on,.program_detail .in_service_main_wrap li > a' ).width(bigWidth) serUl.css('left', -(indexCount - 2) * smallWidth) $('.next').click(function() { if (!serUl.is(':animated')) { if (indexCount > serLi.size() - 2) { } else { indexCount++ serUl.stop().animate({ left: '-=' + smallWidth }) serLi.stop().animate({ width: smallWidth }) serLi .eq(indexCount) .addClass('on') .siblings() .removeClass('on') serLi .eq(indexCount) .stop() .animate({ width: bigWidth }) } } }) $('.prev').click(function() { if (!serUl.is(':animated')) { if (indexCount > 0) { indexCount-- serUl.stop().animate({ left: '+=' + smallWidth }) serLi.stop().animate({ width: smallWidth }) serLi .eq(indexCount) .addClass('on') .siblings() .removeClass('on') serLi .eq(indexCount) .stop() .animate({ width: bigWidth }) } } }) } } } $(function(){ $(document).on("click",".superv_form li dt",function(e){ e.preventDefault(); e.stopPropagation(); $(this).siblings("dd").slideToggle(); }) $(document).on("click",".superv_form li dd p",function(){ $(".superv_form li dt p").text($(this).text()) $(".superv_form li dd").slideUp(); }) $(document).click(function(){ $(".superv_form li dd").slideUp(); }) $(document).on("click",".superv_type p",function(){ $(this).addClass("on").siblings().removeClass("on"); }) })