How to use zepto - 10 common examples

To help you get started, we’ve selected a few zepto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mipengine / mip-extensions-platform / mip-53pop / mip-53pop.js View on Github external
$('#' + popButton + '').click(function () {
                var tval = $('#' + popTel + '').text();
                var add = true;
                var reTel = /^1\d{10}$/;
                var reg = /^0\d{2,3}-\d{7,8}(-\d{1,6})?$/;
                // 判断名字是否为空
                if (popContact !== '') {
                    if ($.trim($('#' + popContact + '').text()) === '') {
                        $('#' + popContact + '').attr('placeholder', '请输入你的姓名');
                        $('#' + popContact + '').css('border-color', '#FF0000');
                    }
                else {
                        $('#' + popContact + ' ').css('border-color', '#d2d2d2');
                        popContactValue = $.trim($('#' + popContact + ' ').text());
                    }
                }
                // 判断联系方式是否为空
                if ($.trim(tval) === ' ') {
                    $('#' + popTel + '').css('border-color', '#FF0000');
                    $('#' + popTel + '').attr('placeholder', '请输入你的手机号码');
                    return;
                }
                else if (reTel.test(tval) === false && reg.test(tval) === false) {
                    $('#' + popTel + '').css('border-color', '#FF0000');
                    $('#' + popTel + '').text('');
                    $('#' + popTel + '').attr('placeholder', '输入的联系方式不正确');
                    return;
                }
                else {
                    $('#' + popTel + '').css('border-color', '#d2d2d2');
github mipengine / mip-extensions-platform / mip-hereseo-pop / mip-hereseo-pop.js View on Github external
var add = true;
                var reTel = /^1\d{10}$/;
                var reg = /^0\d{2,3}-\d{7,8}(-\d{1,6})?$/;
                // 判断名字是否为空
                if (popContact !== '') {
                    if ($.trim(popContactObject.text()) === '') {
                        // $('#' + popContact + '').attr('placeholder', '请输入你的姓名');
                        // $('#' + popContact + '').css('border-color', '#FF0000');
                        popContactObject.attr('placeholder', '请输入你的姓名');
                        popContactObject.css('border-color', '#FF0000');
                        alert('请输入你的姓名');
                        return;
                    }
                    else {
                        popContactObject.css('border-color', '#d2d2d2');
                        popContactValue = $.trim(popContactObject.text());
                    }
                }
                // 判断联系方式是否为空
                if ($.trim(tval) === '') {
                    popTelObject.css('border-color', '#FF0000');
                    popTelObject.attr('placeholder', '请输入你的手机号码');
                    alert('请输入你的手机号码');
                    return;
                }
                else if (reTel.test(tval) === false && reg.test(tval) === false) {
                    popTelObject.css('border-color', '#FF0000');
                    popTelObject.text('');
                    popTelObject.attr('placeholder', '输入的联系方式不正确');
                    alert('输入的联系方式不正确');
                    return;
                }
github mipengine / mip-extensions-platform / mip-zpm-searchjobs / mip-zpm-searchjobs.js View on Github external
function readSearchLs() {
        var indexSearchHs = cs.get('indexSearchHs');
        var $SearchLsWrap = $('.indexSearchList');
        var dtBool = true;
        if (indexSearchHs == null) {
            indexSearchHs = [];
        } else {
            indexSearchHs = indexSearchHs.split(',');
        }
        if (indexSearchHs.length > 0) {
            $SearchLsWrap.children('dd').remove();
            $.each(indexSearchHs, function (i, v) {
                $('<dd><a>' + v + '</a><span class="add"></span></dd>').prependTo($SearchLsWrap);
            });
            $SearchLsWrap.show().find('dt').show().children('.clear').show();
        } else {
            dtBool = false;
            $SearchLsWrap.hide();
        }
    }
    // 保存最新历史记录方法
github yanhaijing / color / modules / html / screen / screen.es View on Github external
function init() {
    render();

    $('#screen').on('touchstart, click', '.block', function (e) {
        e.preventDefault();
        var index = $(this).data('index');
        // 点中了
        if (list[index]) {
            rank = rank &lt; 10 ? 10: rank - 2;
            render();
            ec.emit('screen/click');
        }
    });

    ec.on('game/restart', function () {
        level = 0;
        rank = 40;
        render();
    });
}
github linxiaowu66 / weChat-learning / client / main.js View on Github external
wx.ready(() => {
    // 微信扫码条形码
    $('.g-index-button').on('click', () => {
      wx.scanQRCode({
        needResult: 1,
        desc: 'scanQRCode desc',
        success(res) {
          console.log(JSON.stringify(res));
        }
      });
    })
  })
})
github mipengine / mip-extensions-platform / mip-vd-popup / popup.js View on Github external
var PopupFrame = function (opt) {
        var me = this;
        // 设置默认值
        me.options = $.extend({
            title: '',              // 标题,支持html和Zepto对象
            content: '',            // 内容,支持html和Zepto对象
            fullView: false,        // 是否全屏
            duration: 400,          // 动画执行时间
            customClassName: '',    // 自定义样式名
            onOpen: function () {},
            onClose: function () {}
        }, opt);
        // 初始化
        me._init();
    };
github mipengine / mip-extensions-platform / mip-cr173-eject / mip-cr173-eject.js View on Github external
for (i = 0; i &lt; pageInfo.noAd.length; i++) {
                if (downHref.indexOf(pageInfo.noAd[i]) &gt; -1) {
                    isAds = true;
                }

            }
            if (pageInfo.ismoney === 1) {
                isAds = true;
            }

            if (platform.isIos()) { // IOS
                var iosspUrlid = 0; // 0位适配失败,1为适配成功
                if ($.inArray(spDownUrl, pageInfo.iosspUrl) !== -1) {
                    iosspUrlid = 1;
                }
                var ifiosSp = $.inArray(pageInfo.categroyId, pageInfo.catearrIos);
                if (ifiosSp === -1 &amp;&amp; $('.g-tags-box ul li').length &lt;= 0 &amp;&amp; iosspUrlid === 0) { // 没有匹配到
                    $('.m-down-ul li a').attr({href: 'javascript:;', ispc: true});
                }
                else { // 匹配资源
                    $('.m-down-ul li a').attr('issw', true);
                }
                if (!isAds) {
                    this.iossoftAdd();
                }
            }
            else { // 安卓
                var idArray = [];
                idArray = downHref.split('.');
                if (downHref.indexOf('mo.L5645.net') !== -1 &amp;&amp; $('.g-tags-box ul li').length &lt;= 0) {
                    $('.m-down-ul li a').attr('href', '/down.asp?id=' + idArray[4]);
                    $('.m-down-msg .type b:last').html('系统:Android');
github mipengine / mip-extensions-platform / mip-ychlyxgs-data / mip-ychlyxgs-data.js View on Github external
else { // 安卓
                var idArray = [];
                idArray = downUrl.split('.');
                if (downUrl.indexOf('mo.L5645.net') !== -1 &amp;&amp; $(ele).find('.f-tags-box ul li').length &lt;= 0) {
                    var urlArray = datawebUrl;
                    var windowUrl = window.location.href;
                    var i = 0;
                    for (i = 0; i &lt; urlArray.length; i++) {
                        if (windowUrl.indexOf(urlArray[i]) !== -1) {
                            downBtnLink.attr('href', 'http://m.' + urlArray[i] + '/down.asp?id=' + idArray[4]).attr('data-add', 'add');
                        }

                    }
                }
                else {
                    var azspUrlid = $.inArray(downUrl, azspurl); // 0位适配失败,1为适配成功
                    var ifazSp = $.inArray(pageInfo.categroyId, androidclassid);
                    if (ifazSp === -1 &amp;&amp; $(ele).find('.f-tags-box ul li').length &lt;= 0 &amp;&amp; azspUrlid === -1) {
                        downBtnLink.attr({href: 'javascript:;', ispc: true});
                    }
                    else {
                        downBtnLink.attr('issw', true);
                    }
                }
                if (downBtnLink.attr('ispc')) {
                    $(ele).find('.g-show-title p').html('该软件无安卓版,大家<span>还下载了</span>这些:');
                }
                else {
                    $(ele).find('.g-show-title p').html('大家<span>还下载了</span>这些:');
                }
            }
        }
github mipengine / mip-extensions-platform / mip-ychlyxgs-data / mip-ychlyxgs-data.js View on Github external
function adaptation(iossopurl, iosclassid, datawebUrl, azspurl, androidclassid) { // 设备适配
            if (platform.isIos()) { // IOS
                var iosspUrlid = $.inArray(downUrl, iossopurl);
                var ifiosSp = $.inArray(pageInfo.categroyId, iosclassid);
                var tagSize = $(ele).find('.f-tags-box ul li').length; // tags个数
                if (ifiosSp === -1 &amp;&amp; tagSize &lt;= 0 &amp;&amp; iosspUrlid === -1) { // 没有匹配到
                    downBtnLink.attr({href: 'javascript:;', ispc: true});
                }
                else { // 匹配资源
                    downBtnLink.attr('issw', true);
                }
            }
            else { // 安卓
                var idArray = [];
                idArray = downUrl.split('.');
                if (downUrl.indexOf('mo.L5645.net') !== -1 &amp;&amp; $(ele).find('.f-tags-box ul li').length &lt;= 0) {
                    var urlArray = datawebUrl;
                    var windowUrl = window.location.href;
                    var i = 0;
github mipengine / mip-extensions-platform / mip-linkeddb-upload / mip-linkeddb-upload.js View on Github external
event = event || window.event;
                event.preventDefault();
                $.confirm('登录后操作', '操作提示', function () {
                    window.location.href = sign + window.location.origin + window.location.pathname;
                },
                    function () {
                    });
                return false;
            });
        };
        /* 检查登录 */
        var user = $(ele).attr('sign-in-id');
        var upload = $(ele).find('.photo-album-wrap').attr('upload');
        var request = $(ele).find('.photo-album-wrap').attr('upload-pic');
        var film = $(ele).find('.photo-album-wrap').attr('film');
        $.get(user, function (res) {
            console.log(res);
            if (res.response === '-2') {
                promptLogin('#imgInput0');
                promptLogin('#imgInput1');
            } else {
                // 上传拼图图片
                upLoadPic('#imgInput0', upload, function (res) {
                    console.log(res);
                    photoAlbumWrap.find('.upload-num')
                        .find('.now-cnt')
                        .text(+photoAlbumWrap.find('.upload-num').find('.file-limit').text() - res.data.left_cnt);
                    setImgModal();
                    if (res.data.left_cnt &lt;= 5) {
                        $.toptip('请上传 jpg 或者 png 图片!', 'success');
                        $.post(request + cpId, function (res) {
                            console.log(res);

zepto

Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API. If you use jQuery, you already know how to use Zepto.

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis