代码提示错误
来源:5-8 首页.UI组件-UiSlider(3)
steven_hui
2017-05-12 13:58:51


老师为什么会这样提示??
还有下面的wrap.css为什么有left这个属性,我看过原来的.ui-slider-wrap 这个类的CSS没有position,这里的left怎么生效的,还有后面那个index*width*-1什么原理?详细解释一下
var current=0;
var size=items.size();
var width=items.eq(0).width();
//具体操作
wrap.on('move_prev',function(){
}).on('move_next',function(){
}).on('move_to',function(event,index){
wrap.css('left',index*width*-1);
})
我想知道wrap.triggerHandler('move_to',current) 这个current的值是怎么传到下面move_to 的index呢????
wrap.on('move_prev',function(){
if (current<=0) {
current=size;
}
current=current-1;
wrap.triggerHandler('move_to',current);
}).on('move_next',function(){
}).on('move_to',function(event,index){
wrap.css('left',index*width*-1);
})
//事件
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回答
局部的代码老师无法准确定位问题的所在,你粘贴的是自己写的还是课程中下载的源代码?
相似问题