闪烁效果

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新消息闪烁提示</title>
</head>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>

<script type="text/javascript">

	(function($) {
		$.extend({
			blinkTitle : {
				show : function() {
					var step=0, _title = document.getElementById("number").innerHTML;
						
					var timer = setInterval(function() {
						step++;
						if (step==3) {step=1;};
						if (step==1) {
							document.getElementById("number").style.color="red";
							document.getElementById("number").innerHTML="33"+_title;
						};
						if (step==2) {
							document.getElementById("number").style.color="blue";
							document.getElementById("number").innerHTML="22"+_title;
						};
					}, 500);
					return [timer, _title];
				},
				
				clear : function(timerArr) {	//去除闪烁提示,恢复初始title文本
					if(timerArr) {
						clearInterval(timerArr[0]);
						//document.getElementById("number").innerHTML = timerArr[1];
					};
				}
			}
		});
	})(jQuery);
	
	jQuery(function($) {
		var timerArr = $.blinkTitle.show();
		setTimeout(function() {
			$.blinkTitle.clear(timerArr);
		}, 5000);
	});
	
	</script>

	<script type="text/javascript">
		function show(){
			var obj = document.getElementById("sn");
			if(obj.style.display=="block"){
				obj.style.display ="none";
			}else{
				obj.style.display ="block";
			}
		}
		
		
		//********************//
		$(document).ready(function () {
		$("#close_btn").click(function () {
		$("#pop_msg").hide();
		});
		$("#pop_btn").click(function () {
		$("#pop_msg").show();
		})
		})
		//********************//
		
		
	</script>
	
	<body>
		<p id="shan" style="text-align:center;" title="这是一个实验颜色的tilte">您有 <em id="number"></em> 条新消息</p>
		<br/>
		<p style="text-align:center;"><input type="button" value="请单击" οnclick="show()"/></p>
		<br/>
		<p style="text-align:center;"><input type="button" id="twinkle" value="测试闪烁效果"/></p>
		<div id="sn" style="text-align:center;">
			试试效果
		</div>
    </body>
</html>


效果图 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值