关于强大幻灯片特效noobSlide的使用疑问

ft2920437 2009-07-21 02:05:32
最近小弟接到个任务,主要是用js实现幻灯片的效果

而且目前敲定了了用noobSlide这个脚本,是开源的,效果非常不错

我已经做到主页面配置iframe的src及其自动向下滚动功能


现在就遇到了一个问题,我怎么能够在自己写的js里面调用noobSlide脚本里的事件

比如说我配置的一个iframe的内容滚动到底了,我想让它自动的换到下一个iframe里面去,而且是调用函数的方式,不是用模拟点击按钮的形式
主要是这种js的编写方式我是初次遇到,感觉到了它的强大,当然还有难懂性

如果需要我可以把我的代码发出来,请高手帮帮忙

源码太多了,贴不出来,一会我把我写的贴出来

noobSlide效果的展示地址

http://www.efectorelativo.net/laboratory/noobSlide/
...全文
122 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ft2920437 2009-07-21
  • 打赏
  • 举报
回复
不过这个插件的确很强大,就是可读性差了点,js的通病

也许我还没到那个层次
monexus 2009-07-21
  • 打赏
  • 举报
回复
mootools的插件不是很懂,友情帮顶
ft2920437 2009-07-21
  • 打赏
  • 举报
回复
我先贴一部分noobSlide的代码出来,请大家帮忙看看


	initialize: function(params){
this.items = params.items;
this.mode = params.mode || 'horizontal';
this.modes = {horizontal:['left','width'], vertical:['top','height']};
this.size = params.size || 240;
this.box = params.box.setStyle(this.modes[this.mode][1],(this.size*this.items.length)+'px');
this.button_event = params.button_event || 'click';
this.handle_event = params.handle_event || 'click';
this.onWalk = params.onWalk || null;
this.currentIndex = null;
this.previousIndex = null;
this.nextIndex = null;
this.interval = params.interval || 5000;
this.autoPlay = params.autoPlay || false;
this._play = null;
this.handles = params.handles || null;
if(this.handles){
this.addHandleButtons(this.handles);
}
this.buttons = {
previous: [],
next: [],
play: [],
playback: [],
stop: []
};
if(params.addButtons){
for(var action in params.addButtons){
this.addActionButtons(action, $type(params.addButtons[action])=='array' ? params.addButtons[action] : [params.addButtons[action]]);
}
}
this.fx = new Fx.Tween(this.box,$extend((params.fxOptions||{duration:500,wait:false}),{property:this.modes[this.mode][0]}));
this.walk((params.startItem||0),true,true);
},

addHandleButtons: function(handles){
for(var i=0;i<handles.length;i++){
handles[i].addEvent(this.handle_event,this.walk.bind(this,[i,true]));
}
},

addActionButtons: function(action,buttons){
for(var i=0; i<buttons.length; i++){
switch(action){
case 'previous': buttons[i].addEvent(this.button_event,this.previous.bind(this,[true])); break;
case 'next': buttons[i].addEvent(this.button_event,this.next.bind(this,[true])); break;
case 'play': buttons[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'next',false])); break;
case 'playback': buttons[i].addEvent(this.button_event,this.play.bind(this,[this.interval,'previous',false])); break;
case 'stop': buttons[i].addEvent(this.button_event,this.stop.bind(this)); break;
}
this.buttons[action].push(buttons[i]);
}
}
.....
.....

87,909

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧