cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function popupTips() {
    var arg = arguments,
        txt = '',
        speed = 300,
        zIndex = 9200,
        time = 1500;
    if (arg.length == 1 && typeof(arg[0]) == 'string') {
        txt = arg[0];
    } else if (arg.length == 2 && typeof(arg[0]) == 'string' && !isNaN(arg[1])) {
        txt = arg[0];
        time = arg[1];
    }
    if ($('div.tips_popup').length >= 1) {
        clearTimeout(timer);
        clearTimeout(removeTimer);
        $('#tipsPopup').text(txt);
        var timer = setTimeout(tipRemove, time);
    } else {
        var tipsStr = '<div class="tips_popup" id="tipsPopup" style="padding: 0 10px;position: fixed;background: rgba(0, 0, 0, 0.6);visibility: hidden;display: block;border-radius: 3px;height: 2rem;color: #fff;line-height: 2rem;text-align: center;white-space: nowrap;">' + txt + '</div>';
        $(tipsStr).appendTo($('body'));
        var tpp = $('#tipsPopup');
        console.log(tpp.height())
        console.log(tpp.width())
        tpp.css({
            left: (parseInt($(window).width()) - parseInt(tpp.width()) - 20) / 2,
            top: (parseInt($(window).height()) - parseInt(tpp.height()) - 20) / 2,
            zIndex: zIndex
        });
        tpp.css('visibility', 'inherit').show(speed);
        var timer = setTimeout(tipRemove, time);
    }
    ;
    function tipRemove() {
        var tsp = $('#tipsPopup');
        tsp.hide(speed);
        var removeTimer = setTimeout(function () {
            tsp.remove()
        }, speed);
    }
}