代码提示错误

来源:5-8 首页.UI组件-UiSlider(3)

steven_hui

2017-05-12 13:58:51

http://climg.mukewang.com/59154f040001903c03730089.jpg

http://climg.mukewang.com/59154f04000196fd05220279.jpg

老师为什么会这样提示??




还有下面的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回答

Miss路

2017-05-13

局部的代码老师无法准确定位问题的所在,你粘贴的是自己写的还是课程中下载的源代码?

0
hiss路
回复
hteven_hui
h 解决了就好,能自己找出问题棒棒的,加油!
h017-05-15
共2条回复

0 学习 · 36712 问题

查看课程