在我的第一页中,我使用了一个启动序列 typist.js插入。但是我的行在填满页面后正在扩展,但问题是滚动条站在它的顶部而不是按照顺序。为此,我尝试添加:
.on('type.typist', function() {
window.scrollTo(0, $(document).height());
});
底部代码上的顶部代码。但即使页面上没有显示这些行,它也不起作用。
jQuery(function($) {
$('.typist').typist({ speed: 150 })
.typistPause(1)
.typistAdd('[!]:./action.SYSTEM.BOOT\n')
.typistPause(1)
.typistAdd('\n')
.typistPause(1)
.typistAdd('[!]:./initiating.DEBUG.MODE\n')
});
那么解决方案是什么?感谢您的帮助。
最佳答案
查看源代码以及如何 typist "Dialog" demo在 printPhrase()
函数中执行。添加新对话行后,它调用 jQuery animate()将文档的 body
元素向下移动:
$('body').animate({
scrollTop: $(document).height()
}, 'slow');
关于jquery - typist.js while lines expanding the page scrolling bottom,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31912860/