/*** Created by bd2010141 on 2018/9/28. */ //var t = 5; //var timer; var validator;//表单验证对象 $(document).ready(function(){ _DoAjaxAsyncTrue('GET',{},'/webapi/v1/getSlideshow',function(res){ if(!isempty(res)){ $(".imgPlayer").html(res); //$(".imgPlayer").imgPlayer({}); $('.imgPlayer').owlCarousel({ loop: true, margin: 0, nav:false, dots:true, autoplay:true, autoplayTimeout:4000, autoplayHoverPause:true, animateOut: 'fadeOut', items: 1 }) } }); // 初始化轮播图 $('#featured_carousel').owlCarousel({ margin: 0, nav:false, dots:true, responsive: { 0: { items: 2 }, 580: { items: 3 }, 780: { items: 4 }, 1024:{ items: 5 } } }); var _items = 0; var _width = $(document).width(); var _len = $('.item').length; // 上页 $('#prev').on('click', function (e) { e.preventDefault(); $(this).siblings('#next').css({ cursor:'pointer', opacity:'0.8', filter:'alpha(opacity=80)' }); _items -= 1; if ( _items <= 0) { _items = 0; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } $('#featured_carousel').trigger('to.owl.carousel', [_items, 300]); }); // 下页 $('#next').on('click', function(e) { e.preventDefault(); $(this).siblings('#prev').css({ cursor:'pointer', opacity:'0.8', filter:'alpha(opacity=80)' }); _items += 1; if ( _width >= 1024 ) { if ( _items >= Math.ceil(_len/5) - 1 ) { _items = Math.ceil(_len/5) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } else if ( 780 <= _width && _width < 1024 ) { if ( _items >= Math.ceil(_len/4) - 1 ) { _items = Math.ceil(_len/4) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } else if ( 580 <= _width && _width < 780 ) { if ( _items >= Math.ceil(_len/3) - 1 ) { _items = Math.ceil(_len/3) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } else if ( _width < 580 ) { if ( _items >= Math.ceil(_len/2) - 1 ) { _items = Math.ceil(_len/2) - 1; $(this).css({ cursor:'default', opacity:'0.4', filter:'alpha(opacity=40)' }); } } $('#featured_carousel').trigger('to.owl.carousel', [_items, 300]); }); //添加自定义检查密码的方法 validator=$('#login_form').validate({ rules:{ email:{ required: true }, password:{ required: true, minlength: 6, maxlength:18 } }, messages:{ email:{ required:"请输入邮箱地址或手机号" }, password:{ required:"请输入密码", minlength:"密码最少为6个字符", maxlength:"密码最多为18个字符" } } }); try{ $("#email")[0].focus(); } catch (e){} //tab 切换 $('.index_tab_title li').click(function() { var idx = $(this).index(); $(this).addClass('current').siblings().removeClass('current'); $('.tab_content').eq(idx).show().siblings().hide(); }); _loadIndexNews(); }); function _loadIndexNews(){ _DoAjaxAsyncTrue("GET",{},"/webapi/v1/index/huodongNewsList",function(res){ //加载首页展会 if(res.huodong.length>0){ var aListHtml = '