Mootools插件-闪烁的标题
转自:http://www.cnblogs.com/see7di/archive/2012/10/09/2716024.html
回想起来,我已经好久没有写点啥了,尤其是关于Mootools方面的东西,因此今天写了一个标题闪烁的插件,练练手!
简单说一下这个插件的功能:该插件可以轻松的让您的<title>标题实现闪烁效果.
注意:我所使用的mootools的core版本是1.4.1,其他的版本我并未测试,如果您有测试的话麻烦短消息告知我测试结果,谢谢!
我们先来看一下这个插件的执行效果吧!如下图:

下边是这个插件的代码:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/**插件:閃爍的標題描述:該插件可以輕鬆讓您的<title>標題實現閃爍效果參數: tit:(必填)需要在<title>上閃爍的內容 tim:[可選]閃動頻率,多少毫秒閃動一次 delay:[可選]延遲多少毫秒停止閃動注意: 不管是變量還是方法,只要前邊有下劃綫的均為私有用法: a=new xTitle(); a.Start({tit:'【短消息】',tim:200,delay:6000});/**/var xTitle=new Class({ Implements:[Options,Events], Opt:{ tim:280, //閃動頻率,多少毫秒閃動一次 tit:'', //要閃動的內容 delay:null, //延遲多少毫秒停止閃動 _mess:'', //全局標示符,標記現在需要閃動的內容 _title:'', //原始標題,即<title>標籤內的原始值 _timer1:'', //計時器句柄1 _timer2:'' //計時器句柄2 }, initialize:function(Opt){//初始化构造函数 this.setOptions(Opt);//設置Options if(!this.Opt.tit){return false;} }, _run:function(){ this.Opt._mess=(this.Opt._mess=='') ? this.Opt.tit : ''; $(document).getElement('title').set('text',this.Opt._mess+' '+this.Opt._title); this.Opt._timer1=this._run.delay(this.Opt.tim,this); }, _stop:function(){ clearTimeout(this.Opt._timer1); clearTimeout(this.Opt._timer2); $(document).getElement('title').set('text',this.Opt._title); return false; }, Start:function(o){ if(!o){return false;} this.Opt._title=$(document).getElement('title').get('text'); this.Opt.tim=(o.tim && !isNaN(o.tim)) ? o.tim.toInt() : this.Opt.tim; this.Opt.delay=(o.delay && !isNaN(o.delay)) ? o.delay.toInt() : this.Opt.delay; this.Opt.tit=(o.tit) ? o.tit : this.Opt.tit; if(this.Opt.delay){ this.Opt._timer2=(this._stop.delay(this.Opt.delay,this)); } this._run(); }});a=new xTitle();a.Start({tit:'【短消息】',delay:6000}); |
这个插件的使用方法如下:
<strong>//这是最完整的用法:</strong><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>www.7di.net</title><meta name="generator" content="editplus" /><meta name="copyright" content="www.7di.net" /><script type="text/javascript" src="@img/mootools-core-1.4.1.js" onerror="alert('Error loading '+this.src);"></script></head><body><script language="javascript">a=new xTitle();a.Start({tit:'【短消息】',tim:300,delay:6000});</script> </body></html><strong>//不需要自定义闪烁频率的用法:</strong><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>www.7di.net</title><meta name="generator" content="editplus" /><meta name="copyright" content="www.7di.net" /><script type="text/javascript" src="@img/mootools-core-1.4.1.js" onerror="alert('Error loading '+this.src);"></script></head><body><script language="javascript">a=new xTitle();a.Start({tit:'【短消息】',delay:6000});</script> </body></html><strong>//也不需要自动停止闪烁的用法:</strong><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>www.7di.net</title><meta name="generator" content="editplus" /><meta name="copyright" content="www.7di.net" /><script type="text/javascript" src="@img/mootools-core-1.4.1.js" onerror="alert('Error loading '+this.src);"></script></head><body><script language="javascript">a=new xTitle();a.Start({tit:'【短消息】'});</script> </body></html> |
Mootools插件-闪烁的标题的更多相关文章
- nsis利用ButtonEvent插件移动无标题窗口
众所周知,普通win窗口是带有标题栏的,标题栏的主要功用之一,就是可以方便的拖动窗体,但为了各式各样的目的,有时候我们不得不想办法将其消除,在nsis中主要是靠system插件调用系统函数改变窗体风格 ...
- 从0到1写一款自动为Markdown标题添加序号的Jetbrains插件
1. markdown-index 最近做了一个Jetbrains的插件,叫markdown-index,它的作用是为Markdown文档的标题自动添加序号,效果如下: 目前已经可以在Jetbrain ...
- 一用钟情的VS插件系列总目录(值得收藏)
关于插件,大家的印象可能很多,比如开发者经常使用的Chrome浏览器的扩展程序,某个软件的一个扩展程序等等.我们使用插件的目的是为了提高我们的某些方面的工作效率或者让我们的软件源(Chrome浏览器等 ...
- Sublime Text 3前端开发常用优秀插件介绍
. 首页 博客园 联系我 前言:关于Sublime Text 3. Package Control插件管理. Package Control使用方法/安装Emmet插件. Emmet插件. JsFor ...
- 【转】20个令人敬畏的jQuery插件
为网页设计师和开发推荐20个令人敬畏的jQuery插件.例如滑块,图像画廊,幻灯片插件,jQuery的导航菜单,jQuery文件上传,图像旋转器,标签的插件,用户界面元素,网络接触形式,模态窗口, ...
- MooTools,jQuery库的一些比对
jQuery与MooTools库的一些比对 今天就我自己的一些认识比对下这两个JS框架,更多的是希望大家能够对MooTools这个JS框架有更多的认识.毕竟,大多数从事web前端的人对上手容易的j ...
- iNotify.js通知JS 实现浏览器的 title 闪烁、滚动、声音提示、chrome、Firefox、Safari等系统通知。
https://github.com/jaywcjlove/iNotify JS 实现浏览器的 title 闪烁.滚动.声音提示.chrome.Firefox.Safari等系统通知. 这是重 ...
- vue设置页面标题
使用vue-wechat-title插件对页面标题进行设置 1.安装模块 命令行窗口中运行npm install vue-wechat-title --save PS.如果程序正在运行,ctrl ...
- 2020 史上最全IDEA插件总结
最喜欢的一句话: 1.01的365次方=37.78343433289 >>>1 0.99的365次方= 0.02551796445229, 每天进步一点点的目标,贵在坚持 IDEA ...
随机推荐
- msvc库没有安装包,编译选项选择 代码生成 MT【多线程】,C#调用
参考提过的一个问题,封装VC++动态链接库,C#调用,并将C#程序打包为exe安装包. 感谢大神.
- 手机大数据_SQL映射对象_动软_代码模板_Models
<#@ template language="c#" HostSpecific="True" #> <#@ output extension= ...
- SWIFT UITableView的基本用法
import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...
- Go prepare statment超过mysql最大数
mysql_stmt_prepare failed! error(1461)Can't create more than max_prepared_stmt_count statements (cur ...
- pip是用国内镜像源
pipy国内镜像目前有: http://pypi.douban.com/ 豆瓣 http://pypi.hustunique.com/ 华中理工大学 http://pypi.sdutlinux.o ...
- C# WPF定时器
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来.我们都知道计算机技术发展日新月异,速度惊人的快,你我稍不留神,就会被慢慢淘汰!因此:每日不间断的学习是避免被 ...
- jquery网址
各种分布图的插件:http://echarts.baidu.com/demo.html
- Process启动.exe,当.exe内部抛出异常时,总会弹出一个错误提示框,阻止Process进入结束
public class TaskProcess { [DllImport("kernel32.dll", SetLastError = true)] public static ...
- FlashBuilder 4.7 win64 和 mac版 下载地址
win64 http://trials3.adobe.com/AdobeProducts/FLBR/4_7/win64/FlashBuilder_4_7_LS10_win64.exe mac http ...
- JQuery权限管理
<title></title> <script src="JS/jquery-1.7.1.js"></script> <scr ...