<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="utf-8" />
<meta name="robots" content="all" />
<meta name="keywords" content="yaohaixiao.com,Javascript,newsCarousel,滚动新闻特效,focus on javascript" />
<meta name="description" content="yaohaixiao.com - Focus on javascript." />
<title>newsCarousel - 滚动新闻特效</title>
<link href="http://www.yaohaixiao.com/css/yao.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/newscarousel.css" rel="stylesheet" type="text/css" media="screen" />
<base target="_blank" />
</head>
<body>
<div id="hd">
<h1><strong>YAO</strong>HAIXIAO.COM</h1>
<blockquote>FOCUS ON JAVASCRIPT</blockquote>
<ul id="navigation">
<li><a href="http://www.yaohaixiao.com/index.html">网站首页</a></li>
<li class="current"><a href="http://www.yaohaixiao.com/javascript/index.html">我的Javascript空间</a></li>
<li><a href="http://www.yaohaixiao.com/tools/index.html">Javascript 开发工具</a></li>
<li><a href="http://www.yaohaixiao.com/resource/index.html">Javascript 资源链接</a></li>
<li><a href="http://www.yaohaixiao.com/books/index.html">Javascript 好书推荐</a></li>
<li><a href="http://www.yaohaixiao.com/about/index.html">关于</a></li>
</ul>
</div>
<div class="wrap">
<div id="script">
<h1>newsCarousel - 滚动新闻特效</h1>
<div id="byline">程序开发:<a href="http://www.yaohaixiao.com/">YAOHAIXIAO.COM</a>发表时间:2010 - 01 - 27</div>
<div id="y-today">
<div id="yt-mod">
<ul id="yt-carousel">
<li>
<div class="yt-bd">
<h2><a href="http://www.yaohaixiao.com/?p=621" target="_blank" title="for in Intrigue"><img src="samples/2.jpg" alt="for in Intrigue" /></a></h2>
<h3><a href="http://www.yaohaixiao.com/?p=621" target="_blank">for in Intrigue</a></h3>
<p> One of JavaScript’s best features is the ability to augment the built-in types. If we want to add a new method to a type, we simply assign a function to the type’s prototype.[<a href="http://www.yaohaixiao.com/?p=621" target="_blank">Details</a>]</p>
</div>
</li>
</ul>
</div>
</div>
<h2>程序简介</h2>
<p>
<strong>newsCarousel - 滚动新闻特效</strong>,我用我自己写的YaoUI代码库,模仿的YAHOO.COM新版首页的一个滚动新闻效果,新闻滚动的瞬间加载JSON数据。功能实用,调用简单,兼容性好,希望大家能喜欢。
</p>
<h2>调用方法</h2>
<p>
<strong>第一步:</strong>在页面中调用yao.js文件,例如:
</p>
<p>
<script type="text/javascript" src="js/yao.js"></script>
</p>
<p><strong>第二步:</strong>编写调用代码:<br />
<pre>
(function(){
var newsCarousel = new YAO.newsCarousel({
carouselCnt: YAO.getEl('yt-mod'),
carousel: YAO.getEl('yt-carousel'),
items: 'li',
root: YAO.getEl('y-today'),
ajaxable: true,
ajaxItemNum: 9
});
newsCarousel.init();
})();
</pre>
</p>
<h2>程序代码</h2>
<textarea>
var YAO = function(){
var D = document, OA = '[object Array]', OF = "[object Function]", OP = Object.prototype, nt = "nodeType", listeners = [], webkitKeymap = {
63232: 38, // up
63233: 40, // down
63234: 37, // left
63235: 39, // right
63276: 33, // page up
63277: 34, // page down
25: 9 // SHIFT-TAB (Safari provides a different key code in
}, patterns = {
HYPHEN: /(-[a-z])/i,
ROOT_TAG: /body|html/i
}, lastError = null;
return {
isArray: function(obj){
return OP.toString.apply(obj) === OA;
},
isString: function(s){
return typeof s
=== 'string';
},
isBoolean: function(b){
return typeof b === 'boolean';
},
isFunction: function(fn){
return OP.toString.apply(fn) === OF;
},
isNull: function(obj){
return obj === null;
},
isNumber: function(num){
return typeof num === 'number' && isFinite(num);
},
isObject: function(str){
return (str && (typeof str === "object" || this.isFunction(str))) || false;
},
isUndefined: function(obj){
return typeof obj === 'undefined';
},
hasOwnProperty: function(obj, prper){
if (OP.hasOwnProperty) {
return obj.hasOwnProperty(prper);
}
return !this.isUndefined(obj[prper]) && obj.constructor.prototype[prper] !== obj[prper];
},
isMobile: function(mobile){
return /^(13|15|18)\d{9}$/.test(YAO.trim(mobile));
},
isName: function(name){
return /^[\w\u4e00-\u9fa5]{1}[\w\u4e00-\u9fa5 \.]{0,19}$/.test(YAO.trim(name));
},
keys: function(obj){
var b = [];
for (var p in obj) {
b.push(p);
}
return b;
},
values: function(obj){
var a = [];
for (var p in obj) {
a.push(obj[p]);
}
return a;
},
isXMLDoc: function(obj){
return obj.documentElement && !obj.body || obj.tagName && obj.ownerDocument && !obj.ownerDocument.body;
},
formatNumber: function(b, e){
e = e || '';
b += '';
var d = b.split('.');
var a = d[0];
var c = d.length > 1 ? '.' + d[1] : '';
var f = /(\d+)(\d{3})/;
while (f.test(a)) {
a = a.replace(f, '$1,$2');
}
return e + a + c;
},
unformatNumber: function(a){
return a.replace(/([^0-9\.\-])/g, '') * 1;
},
stringBuffer: function(){
var a = [];
for (var i = 0; i < arguments.length; ++i) {
a.push(arguments[i]);
}
return a.join('');
},
trim: function(str){
try {
return str.replace(/^\s+|\s+$/g, '');
}
catch (a) {
return str;
}
},
stripTags: function(str){
return str.replace(/<\/?[^>]+>/gi, '');
},
stripScripts: function(str){
return str.replace(/<script[^>]*>([\\S\\s]*?)<\/script>/g, '');
},
isJSON: function(obj){
obj = obj.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(obj);
},
encodeHTML: function(str){
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
},
decodeHTML: function(str){
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
},
toCamel: function(property){
if (!patterns.HYPHEN.test(property)) {
return property;
}
if (propertyCache[property]) {
return propertyCache[property];
}
var converted = property;
while (patterns.HYPHEN.exec(converted)) {
converted = converted.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());
}
propertyCache[property] = converted;
return converted;
},
Cookie: {
set: function(g, c, f, b){
var e = new Date();
var a = new Date();
if (f == null || f == 0) {
f = 1;
}
a.setTime(e.getTime() + 3600000 * 24 * f);
D.cookie = g + '=' + encodeURI(c) + ';expires=' + a.toGMTString() + ';domain=' + b + '; path=/';
},
get: function(e){
var b = D.cookie;
var d = e + '=';
var c = b.indexOf('; ' + d);
if (c == -1) {
c =
没有合适的资源?快使用搜索试试~ 我知道了~
JavaScript 自定义的图文滚动新闻特效
共27个文件
jpg:11个
js:10个
db:2个
需积分: 10 22 下载量 57 浏览量
2010-04-08
18:48:04
上传
评论
收藏 240KB RAR 举报
温馨提示
JavaScript 自定义的图文滚动新闻特效 newsCarousel - 滚动新闻特效,核心 是YTab,作者当然是位JS编程高手了,他的作品不至这些,这是其中一款用于图片+文字结合的新闻滚动特效,每点击一次小按钮,滚动一次,用作图片导航比较合适的作品。
资源推荐
资源详情
资源评论
收起资源包目录
newsCarousel.rar (27个子文件)
codefans.net
newsCarousel
css
newscarousel.css 1KB
img
loading.gif 1KB
Thumbs.db 7KB
arrow.jpg 634B
ico-arrow.gif 9KB
js
yao.js 41KB
samples
5.jpg 19KB
3.jpg 15KB
8.jpg 22KB
4.jpg 27KB
9.jpg 18KB
2.jpg 12KB
10.jpg 10KB
1.jpg 19KB
Thumbs.db 25KB
json
2.js 610B
3.js 653B
5.js 620B
1.js 562B
4.js 575B
8.js 606B
7.js 619B
9.js 600B
6.js 613B
6.jpg 13KB
7.jpg 29KB
index.html 47KB
共 27 条
- 1
资源评论
mirage1982
- 粉丝: 59
- 资源: 1051
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功