JQUERY DIV浮动提示信息

    function showTips(tips, height, time) {
var windowWidth = document.documentElement.clientWidth;
var tipsDiv = '<div class="tipsClass">' + tips + '</div>';

$(
'body').append(tipsDiv);
$(
'div.tipsClass').css({
'top': height + 'px',
'left': (windowWidth / 2) - (tips.length * 13 / 2) + 'px',
'position': 'absolute',
'padding': '3px 5px',
'background': 'red',
'font-size': 12 + 'px',
'margin': '0 auto',
'text-align': 'center',
'width': 'auto',
'color': '#fff',
'opacity': '0.8'
}).show();
setTimeout(
function () { $('div.tipsClass').fadeOut(); }, (time * 1000));
}

  

posted @ 2011-09-14 09:19  biubiubiu  阅读(594)  评论(0编辑  收藏  举报