"use strict"; (function () { var guides = []; if (Utils.isMoblie()) { $('#contact-3').attr("href", "tel:95015"); } // 手风琴效果 function accordion() { var guideTitles = $('.footer .guide .g-list .g-title'); $(guideTitles).each(function (index) { var _this = this; var close = true; $(this).click(function () { if (close) { $(_this).children('.btn-icon').css({ transform: 'rotate(315deg)' }); $(guides[index].target).css({ 'height': guides[index].height }); setTimeout(function () { $(guides[index].target).css({ 'height': 'auto' }); }, 300); } else { $(_this).children('.btn-icon').css({ 'transform': 'rotate(135deg)' }); $(guides[index].target).css({ 'height': $(_this).next().css('height') }); setTimeout(function () { $(guides[index].target).css({ 'height': 0 }); }, 10); } close = !close; }); }); } // 为了丝滑,通过js获取隐藏高度 function getGuideHeight() { //先获取高度,在隐藏 $('.footer .guide .guide-wrap').each(function (index) { var height = 0; $(this).children().each(function () { if (!$(this).hasClass('guide-wrap')) { height += parseInt($(this).outerHeight(true)); } }); guides.push({ target: this, height: height }); $(this).css('height', 0); }); } var width = $(window).width(); $(window).resize(function () { width = $(window).width(); if (width <= 768) { getGuideHeight(); accordion(); } }); if (width <= 768) { getGuideHeight(); accordion(); } })();