亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

手動觸發scroll之后設置scrollTop值無效

手動觸發scroll之后設置scrollTop值無效

牧羊人nacy 2018-12-21 15:14:24
手動觸發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);
查看完整描述

1 回答

?
忽然笑

TA貢獻1806條經驗 獲得超5個贊

試試 window.scrollTo(x,y)


查看完整回答
反對 回復 2019-01-14
  • 1 回答
  • 0 關注
  • 1457 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號