mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
optimize javascript scrollIntoView
This commit is contained in:
parent
9857ed0559
commit
66ed1c0507
|
@ -752,7 +752,7 @@ void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
|||
return; // No action on background page, scrollIntoView there don't work
|
||||
|
||||
if(moveToIt){
|
||||
QString script=QString(" document.getElementById('%1').scrollIntoView(true);").arg(id);
|
||||
QString script=QString(" var elem=document.getElementById('%1'); if(elem!=undefined){elem.scrollIntoView(true);}").arg(id);
|
||||
|
||||
ui.definition->page()->runJavaScript(script);
|
||||
|
||||
|
|
Loading…
Reference in a new issue