滚动脚本,滚动顶部,回调函数



在这里,我正在运行一个成绩单,这也突出显示了当前单词。当成绩单向上滚动并且文本失去视图时,问题也会丢失,突出显示也是如此。我想发生的是,当突出显示到达框的顶部时,它应该保持在顶线上的视野中,而不会向上消失。你能帮忙吗???

function runTransript() {
//var player = _V_('video');
 //var videoCurrentTime = player.currentTime();
var transcriptSpeed = 300; //videoCurrentTime; 
transcriptSpeed *= $("#transcript .full-transcript").parent().height();
$("div").css({ top: $(this).parent().height() + 'px' });
$("div").animate({top: -$(this).height() }, transcriptSpeed, 'linear');
$(".transcript-text").each(function(index){
    var curObj = $(this);
    var interval = $(this).attr('time');
    curObj.delay(interval).animate({color: '#5c9127'}, 100, function() {
        $(this).prev().removeAttr("style").prev().removeAttr("style").prev().removeAttr("style");
    });
});

}

函数 runTransript() {

var player = _V_('video'),
    videoCurrentTime = player.currentTime(),
    lineCount = 1,
    transcriptSpeed = videoCurrentTime;
transcriptSpeed *= $("#transcript .full-transcript").parent().height();
$("div").css({ top: $(this).parent().height() + 'px' });
$("div").each(function(index){
    var curObj = $(this);
    var interval = $(this).attr('time');
    curObj.delay(interval).animate({color: '#f0e53d'}, 100, function() {
        var pos = $(this).position();
        console.log(pos.left);
        if(parseInt(pos.left) == 15 && index > 0){
            $("div").delay(2000).animate({top: "-"+parseInt(lineCount*35)+"px" }, 'slow', 'linear');
            lineCount++;
        } 
        $(this).addClass('active').prev().removeClass('active').removeAttr("style");
    });
});

}

最新更新