为什么on和triggerHandler后面可以加auto_move,move_next
为什么on和triggerHandler后面可以加auto_move,move_next,不是只可以加click,mouseover这类关键字吗?
wrap
.on('move_prev',function(){
if(current<=0){
current = size;
}
current = current - 1 ;
wrap.triggerHandler('move_to',current);
})
.on('move_next',function(){
if( current >= size-1){
current = -1;
}
current = current + 1 ;
wrap.triggerHandler('move_to',current);
})
.on('move_to',function(evt,index){
wrap.css('left',index*width*-1);
tips.removeClass('item_focus').eq(index).addClass('item_focus');
})
.on('auto_move',function(){
setInterval(function(){
enableAuto && wrap.triggerHandler('move_next');
},2000);
})
.triggerHandler('auto_move');
// 事件
btn_prev.on('click',function(){
wrap.triggerHandler('move_prev');
});
btn_next.on('click',function(){
wrap.triggerHandler('move_next');
});
tips.on('click',function(){
var index = $(this).index();
wrap.triggerHandler('move_to',index);
})
正在回答 回答被采纳积分+1
老师,还有要怎样去理解使用
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星