var mLayer = function (ev) { $('.m_layer').removeClass('show'); $('.m_layer').children().removeClass('show'); $('input').blur(); $('html,body').css({ 'height': 'auto', 'overflow': 'visible' }) ev.preventDefault(); } var common = { init: function () { this.mLayer(); }, isTrue: function (bl, fn) { bl && fn && fn(this); }, // swiper swiper: function () { var swiper = new Swiper('#swiper_1', { pagination: '.swiper-pagination', paginationClickable: true, loop: true, autoplay: 3000, speed: 500, eventTarget: 'container', autoplayDisableOnInteraction: false }); }, guessList: function () { // 猜你喜欢 var swiper = new Swiper('#guess_list', { slidesPerView: 3, slidesPerGroup: 3, speed: 500 }); }, // 判断是否有效点击 isMove: function (obg, fn) { bOk = true; $(obg).on('touchstart', function () { bOk = true; }); $(document).on('touchmove', function () { bOk = false; }); $(obg).on('touchend', function (ev) { if (!bOk) return; fn(this, ev); return false; }); }, mLayer: function () { this.isTrue($('.m_layer')[0], function () { $('.m_layer').on('touchmove', function (ev) { ev.preventDefault(); }); }) this.isMove($('.m_layer'), function (_this, ev) { mLayer(ev); }); this.isMove($('.close'), function (_this, ev) { mLayer(ev); }); }, sucLayer: function (str) { var str = str || '加入清单成功'; var oS = str; $('body').append('
" + StringText + "
' + f1 + '
' + '' + f2 + '
' + '' + f3 + '
' + '