$(function () { // 移除图片宽高 $(".removeimg").find("section").removeAttr("width").css("width", "100%"); $(".removeimg").find("img").removeAttr("width").css("width", "auto").css("max-width", "100%"); $(".removeimg").find("img").removeAttr("height").css("height", "auto"); $(".removeimg span").remove('margin').css("margin", "auto"); $(".removeimg span").remove('width').css("width", "auto"); $(".removeimg span").remove('height').css("height", "100%"); $(".removeimg p").remove('text-indent').css("text-indent", "0"); $(".removeimg p").remove('height').css("height", "100%"); $("table").remove('text-indent').attr("text-indent", '0'); $("table").remove('width').attr("width", '100%'); $("table").remove('border').attr("border", '1'); //视频处理 $(".videoIFrame").attr("width", "100%").attr("height", 200); }); // =======轮播图初始化======== $(document).ready(function () { var mySwiper_banner = new Swiper('#banner > .swiper-container', { loop: true, // 循环模式选项 // 自动播放 autoplay: { delay: 4000, stopOnLastSlide: false, disableOnInteraction: true, }, // 分页器 pagination: { el: '#pagination-banner', }, on: { slideChangeTransitionStart: function () { $('#banner .swiper-slide').find('h3').hide().removeClass('') }, slideChangeTransitionEnd: function () { var index = this.activeIndex var animate switch (index) { case 0: animate = 'bounceInDown' break case 1: animate = 'rotateIn' break case 2: animate = 'slideInUp' break case 3: animate = 'zoomIn' break case 4: animate = 'bounceInDown' break case 5: animate = 'rotateIn' break } animate += ' animated' $('#banner .swiper-slide').eq(index).find('h3').show().addClass(animate) }, }, }) var htmlFontSize = $('html').css('font-size') var unit = htmlFontSize.slice(-2) var space = parseFloat(htmlFontSize) * .4 var index = $('#banner-solution .swiper-slide.active').index() var mySwiper_solution = new Swiper('#banner-solution', { freeMode: true, slidesPerView: 3.6, spaceBetween: space, freeModeMomentumBounce: false, slidesOffsetAfter: space / 2, initialSlide: index, }) var muSwiper_tech = new Swiper('#banner-tech > .swiper-container', { slidesPerView: 3.3, spaceBetween: space, slidesOffsetAfter: space / 2, centerInsufficientSlides: true, }) var mySwiper_cases = new Swiper('#related-case > .swiper-container', { // 分页器 pagination: { el: '#pagination-cases', }, slidesPerView: 2, slidesPerGroup: 2, spaceBetween: space, }) var mySwiper_news = new Swiper('#banner-news > .swiper-container', { loop: true, // 循环模式选项 // 自动播放 autoplay: { delay: 4000, stopOnLastSlide: false, disableOnInteraction: true, }, // 分页器 pagination: { el: '#pagination-banner', }, }) var mySwiper_special = new Swiper('#banner-special > .swiper-container', { loop: true, slidesPerView: 'auto', loopedSlides: 5, slidesPerView: 2.3, spaceBetween: space + 5, centeredSlides: true, }) var mySwiper_qualification = new Swiper('#banner-qualification', { slidesPerView: 2.6, spaceBetween: space, slidesOffsetAfter: space / 2, }) var mySwiper_honor = new Swiper('#banner-honor', { slidesPerView: 2.4, spaceBetween: space, slidesOffsetAfter: space / 2, }) }) // =======容量搜索======== $(function ($) { $('.form-search input[name = ton]').on('blur', function () { var url var value = parseInt($(this).val()) value = value ? value : 1 value = value <= 0 ? 1 : value if (value > 150) { url = '151-280t' } else if (value > 100 && value <= 150) { url = '101-150t' } else if (value > 75 && value <= 100) { url = '76-100t' } else if (value > 50 && value <= 75) { url = '51-75t' } else if (value > 30 && value <= 50) { url = '31-50t' } else if (value > 20 && value <= 30) { url = '21-30t' } else if (value > 10 && value <= 20) { url = '11-20t' } else { url = '1-10t' } $('#search_capacity').attr('href', '/solution/capacity/' + url + '.html') }) }) // =======技术参数切换======== $(function ($) { if ($('.data-para').eq(0).find('table').length > 0) { var col = $('.data-para').eq(0).find('table').eq(0).attr('data-col') col = col ? col : '1' $('.data-para').eq(0).find('table').eq(0).FrozenTable(0, 0, col) $('.technique > .type .swiper-slide').on('click', function () { $(this).addClass('active').siblings('.swiper-slide').removeClass('active') var index = $(this).index() col = $('.data-para').eq(index).find('table').eq(0).attr('data-col') col = col ? col : '1' $('.data-para').eq(index).fadeIn().siblings().hide() $('.data-para').eq(index).find('table').eq(0).FrozenTable(0, 0, col) }) } }) // =======头部搜索按钮======== $(function ($) { $('header .head-top .search').on('click', function () { $('header .head-top .inner_c').show().removeClass('slideOutLeft').addClass('slideInRight animated') }) $('header .head-top .inner_c .close').on('click', function () { console.log(111) $('header .head-top .inner_c').removeClass('slideInRight').addClass('slideOutLeft') setTimeout(function () { $('header .head-top .inner_c').hide() }, 800) }) $('header .head-top .inner_c input[name = keywords]').on('blur', function () { var keywords = $(this).val() }) }) // =======侧边导航栏的显示与隐藏======== $(function ($) { $('.side-nav').hide() $('#side-nav-btn').on('click', function () { if (!$('header').hasClass('active')) { $('header').addClass('active') $('.side-nav').show().removeClass('bounceOutDown').addClass('bounceInDown') } else { $('.side-nav').removeClass('bounceInDown').addClass('bounceOutDown') setTimeout(function () { $('.side-nav').hide() $('header').removeClass('active') }, 600) } }) }) // =======form表单验证======== $(function ($) { var telReg = /^[1][0-9]{9}\d$/ $('form button').on('click', function () { var form = $(this).parent() var tel = form.find("input[name = tel]") var product = form.find("select[name = product]") // 如果有警告框,先移除警告框 var alertObj = form.parent().find('.alert')[0] if (alertObj) alertObj.remove() // 判断是否有电话输入框 if (tel.length > 0) { // 获取电话输入框的值 var telval = tel.val() // 定义警告框的内容 var alert = '
请正确填写手机号
' // 如果电话输入框为空 , 或者输入的不是一个手机号 if (!telval || !telReg.test(telval)) { // 弹出警告框 , 并阻止表单提交 form.before(alert) form.parent().addClass('shake animated') setTimeout(function () { form.parent().removeClass('shake animated') }, 600) return false } } if (product.length > 0) { var optionIndex = product[0].selectedIndex var productVal = product.find('option').eq(optionIndex).val() if (!productVal) { var alert = '请选择您需要的设备
' // 弹出警告框 , 并阻止表单提交 form.before(alert) form.parent().addClass('shake animated') setTimeout(function () { form.parent().removeClass('shake animated') }, 600) return false } } }) }) // =======产品、案例导航======== $(function ($) { $('.p-nav-list nav a').hide() $('#product-cut').on('click', function () { // ==========方案一========== // $('.p-nav-list').show().addClass('slideInDown animated').find('nav a').each(function (index,iteam) { // setTimeout(function () { // $(iteam).show().addClass('fadeInDownBig animated') // },index*100) // }) // ==========方案二========== $('.p-nav-list').show(function () { $(this).find('nav a').each(function (index, iteam) { setTimeout(function () { $(iteam).show().addClass('fadeInDown animated') }, index * 100) }) }).addClass('slideInDown animated') }) // ==========方案三========== // $('.p-nav-list').show(function () { // $(this).find('nav a').each(function (index, iteam) { // setTimeout(function () { // $(iteam).show().addClass('zoomIn animated') // }, index * 100) // }) // }).addClass('slideInDown animated') // }) $('.p-nav-list').on('click', function () { $(this).find('nav a').hide() $(this).fadeOut() }) }) // =======加载更多列表======== $(function ($) { $('#moreList').on('click', function () { var page = $(this).attr('data-page') var classid = $(this).attr('data-classid') $(document).on('ajaxStart', function () { $('.loading').show() }) $(document).on('ajaxComplete', function () { $('.loading').hide() }) $.getJSON('/moreList.php', {page: page , classid: classid}, function (res) { var html = $('#list_m').render(res.list) if (res.page) { $('#moreList').before(html).attr('data-page', res.page) } else { $('#moreList').before(html).after('我是有底线的
').hide() } }) $.views.helpers({ substr: function (string, index, length) { return string.substr(index, length) }, }) }) }) // =======微信二维码======== $(function ($) { $('.contact-others a.wx').on('click', function () { $(this).find('.bg-cover').fadeIn() }) $('.contact-others a.wx .bg-cover').on('click', function () { $(this).fadeOut() return false }) $('.contact-others a.wx .bg-cover img').on('click', function () { return false }) }) // =======小键盘弹出导致页面滚动解决======== $(function ($) { var height = $(window).height() $(window).on('resize' , function () { if ($(window).height() < height) { $('.footer-nav').css('position' , 'static') }else { $('.footer-nav').css('position' , 'fixed') } }) })