HTML Mootools新闻旋转

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTML Mootools新闻旋转相关的知识,希望对你有一定的参考价值。

window.addEvent('domready',fuction(){
	var rotater = new Rotater('.slide',{ //Class of elements that should rotate.
		slideInterval:4000, //Length of showing each element, in milliseconds
		transitionDuration:1000, //Length crossfading transition, in milliseconds
	});
});



var Rotater=new Class({Implements:[Options,Events],options:{slideInterval:4000,transitionDuration:1000,startIndex:0,autoplay:true},initialize:function(B,A){this.setOptions(A);this.slides=$$(B);this.createFx();this.showSlide(this.options.startIndex);if(this.slides.length<2){this.options.autoplay=false}if(this.options.autoplay){this.autoplay()}return this},toElement:function(){return this.container},createFx:function(){if(!this.slideFx){this.slideFx=new Fx.Elements(this.slides,{duration:this.options.transitionDuration})}this.slides.each(function(A){A.setStyle("opacity",0)})},showSlide:function(B){var A={};this.slides.each(function(C,D){if(D==B&&D!=this.currentSlide){A[D.toString()]={opacity:1}}else{A[D.toString()]={opacity:0,}}},this);this.fireEvent("onShowSlide",B);this.currentSlide=B;this.slideFx.start(A);return this},autoplay:function(){this.slideshowInt=this.rotate.periodical(this.options.slideInterval,this);this.fireEvent("onAutoPlay");return this},stop:function(){$clear(this.slideshowInt);this.fireEvent("onStop");return this},rotate:function(){current=this.currentSlide;next=(current+1>=this.slides.length)?0:current+1;this.showSlide(next);this.fireEvent("onRotate",next);return this}});

MooTools中文介绍

  MooTools是一个简洁,模块化,面向对象的JavaScript框架。它能够帮助你更快,更简单地编写可扩展和兼容性强的JavaScript代码。

  Mootools从Prototype.js中汲取了许多有益的设计理念,语法也和其极其类似。但它提供的功能要比Prototype.js多,整体设计也比Prototype.js要相对完善,功能更强大,比如增加了动画特效、拖放操作等等。

  总之,Mootools是一个非常优秀的Javascript框架,更多精髓部分等待你去发掘,希望你也能通过学习和使用而喜欢上Mootools,甚至

  喜欢上Javascript :)www.hebby120.com

  MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write powerful, flexible, and cross-browser code with its elegant, well documented, and coherent API.

  MooTools code respects strict standards and doesn‘t throw any warnings. It‘s well commented and has meaningful variable names: a joy to browse and a snap to understand.

以上是关于HTML Mootools新闻旋转的主要内容,如果未能解决你的问题,请参考以下文章

MooTools的瑕疵

HTML 使用mootools进行电子邮件保护

mootools 请求类和 CORS

视差动画 - 雅虎新闻摘要加载

使用 mootools 进行简单的 Div Opacity Fade on Focus

Mootools教程资源