layui.define(['layer', 'form','element','table','jquery','laydate'], function(exports){ var layer = layui.layer,form = layui.form,element=layui.element,table=layui.table;//引入所依赖的模块 //start:公共js代码开始 //点击按钮#menu-btn显示隐藏菜单 $('.head-icon span').on('click', function(event) { if($(".navbar:visible").length == 0){ $('.head-icon').addclass('active'); $('.navbar').fadein('slow'); }else{ $('.head-icon').removeclass('active'); $('.navbar').fadeout('slow'); } }); //导航栏菜单鼠标悬停显示下拉菜单 $('#nav li').hover( function(){ $(this).addclass('active');$(this).children('.submenu').slidedown(300); }, function(){ $(this).removeclass('active');$(this).children('.submenu').slideup(300); } ); //公共tab选项卡js $('.tab_items li').hover(function(){ $(this).addclass('active').siblings('li').removeclass('active'); var index = $(this).index(); $(this).parents().next().find('.tab_con').eq(index).show().siblings().hide(); }); //banner轮播js var swiper = new swiper('.swiper-container', { autoplay: { delay: 2500, disableoninteraction: false, }, pagination: { el: '.swiper-pagination', clickable: true, }, navigation: { nextel: '.swiper-button-next', prevel: '.swiper-button-prev', }, debugger: true, }); //case滚动 jquery(".honor-scroll").slide({ maincell:".bd ul", effect:"leftloop",vis:5, pnloop:false, scroll:1, autopage:true,autoplay:true,}); $(".problem-scroll").slide({maincell:".bd ul",autoplay:true,effect:"topmarquee",vis:3,intertime:50,trigger:"click"}); //站内检索 form.on('submit(search)',function(data){ }); $(".win-homepage").click(function(){ if(document.all){ document.body.style.behavior="url(#default#homepage)"; document.body.sethomepage(document.url); }else{ alert("设置首页失败,请手动设置!") } }); $(".win-favorite").click(function(){ var surl=document.url;var stitle=document.title; try{ window.external.addfavorite(surl,stitle); }catch(e){ try{ window.sidebar.addpanel(stitle,surl,"") }catch(e){ alert("加入收藏失败,请使用ctrl+d进行添加") } } }); $(".win-forward").click(function(){ window.history.forward(1); }); $(".win-back").click(function(){ window.history.back(-1); }); $(".win-backtop").click(function(){ $("body,html").animate({scrolltop:0},1000); return false; }); $(".win-refresh").click(function(){ window.location.reload(); }); $(".win-print").click(function(){ window.print(); }); $(".win-close").click(function(){ window.close(); }); //end:公共js代码结束 exports('common', {}); //注意,这里是模块输出的核心,模块名必须和use时的模块名一致 }); //留言框 $(function(){ var init_class = true; $('#headd .ly_2').click(function(){ $('#headd .connn').toggle(); if(init_class){ $('#headd .ly_2 span').removeclass('icon-jianhao').addclass('icon-jiahao'); init_class = false; }else{ $('#headd .ly_2 span').removeclass('icon-jiahao').addclass('icon-jianhao'); init_class = true; } }); $('#close_im').click(function(){ $('#toolbar-lianxi').hide(); }); $('.toolbar-item-tonghua').hover( function(){$('.call').show(); }, function(){$('.call').hide(); } ); }); function check_caigou(){ var notnull= true; if($('#contactor').val()==''){ notnull=false; alert('联系姓名不能为空!'); }else if($('#mobile').val()==''){ notnull=false; alert('手机号不能为空!'); }else if($('#mobile').val()==''){ notnull=false; alert('留言内容不能为空!'); } if(notnull){ $.ajax({ type:"post", url:$('#form-caigou').attr('action'), //url:"{:url('product/guestbook')}", data:$('#form-caigou').serialize(), success: function (data) { if (data.status == 0){ layer.open({ title: '输入信息错误', icon: 5, time: 3000, content: data.msg }); }else{ layer.open({ title: data.msg, icon: 6, time: 3000, content: data.msg+'感谢您的关注!' }); } } }); } } $('#btn_liuyan').click(function(){ check_caigou(); });