手动触发scroll之后设置scrollTop值无效,需要手动点击一下才页面才会滚动,有人遇到过吗?怎么解决的,贴出代码!
//topArr 是一个数组,每个div的getBoundingClientRect().top;
_this.videoPlayer.on('playing',function(){
_this.videoPlayer.setVideoMute(true);
$section.parent().scrollTop(0);
$section.find('.caption-detail').removeClass('location');
var $clickSecion = $section.eq(0);
var curIndex = -1;
timer = setInterval(function(){
var ct = _this.videoPlayer.getVideoCurrentTime();
timeArr.forEach(function(item,index){
if(ct>=item.startTime && ct< item.endTime){
if(curIndex != index){
$clickSecion = $section.eq(index);
var st = $section.get(index).getBoundingClientRect();
$section.find('.caption-detail').removeClass('location');
$clickSecion.find('.caption-detail').addClass('location');
$section.parent().animate({scrollTop: topArr[index]-topArr[0]},100,function(){
$section.parent().bind('scroll');
});
curIndex = index;
}
}
});
},100);
忽然笑
相关分类