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);
|
}
|
}
|