点击某按钮,提示某信息,相信大家经常遇到,用别人的插件总需要修改点,但是修改起来又很费时间,所以干脆自己写吧,哈哈。代码及效果如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>闪烁提示信息</title>
<style>
#show_good{
background:orange;
position:absolute;
display:none;
border:2px solid #ffff00;
border-radius:5px;
text-align:center;
}
</style>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$(function(){
var windows_width = $(window).width();
var windows_height = $(window).height();
var div_width = 400;
var div_height = 100;
var div_left = (windows_width - div_width) / 2;
var div_top = windows_height / 2 - div_height;
var div_css = 'left:' + div_left + 'px;top:' + div_top + 'px;width:' + div_width + 'px;height:' + div_height + 'px;';
var content = '<div id="show_good" >';
content += '闪烁提示信息';
content += '</div>';
$('body').append(content);
$('p').click(function(){
$('#show_good').fadeIn(1000,function(){
setTimeout(function(){
$('#show_good').fadeOut(1000);
},1000);
});
});
//console.log(windows_width,windows_height,div_css);
});
});
</script>
</head>
<body >
<p>闪烁提示信息</p>
</body>
</html>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。