JQuery 浮动DIV展示提示信息并自动隐藏
JQuery 浮动DIV显示提示信息并自动隐藏
引自:http://www.cnblogs.com/showblog/archive/2010/08/27/1810427.html
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': '#8FBC8F', '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 ) ); }
引自:http://www.cnblogs.com/showblog/archive/2010/08/27/1810427.html