From d74dbc9ae8684719c70eb3b0f27440a58c449940 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 3 Jan 2017 17:58:19 +0100 Subject: [PATCH] Improved scrolling to search result --- wcfsetup/install/files/acp/templates/option.tpl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/option.tpl b/wcfsetup/install/files/acp/templates/option.tpl index c1b2b4d51d..6de4f3d264 100644 --- a/wcfsetup/install/files/acp/templates/option.tpl +++ b/wcfsetup/install/files/acp/templates/option.tpl @@ -7,13 +7,16 @@ new WCF.Option.Handler(); {if $optionName} - var $option = $('#' + $.wcfEscapeID('{$optionName}')); - new WCF.PeriodicalExecuter(function(pe) { - pe.stop(); + setTimeout(function() { + var option = elById('{$optionName}'); + var div = elCreate('div'); + div.id = 'wcfOptionAnchor'; + div.style.setProperty('position', 'absolute', ''); + div.style.setProperty('top', (option.closest('dl').offsetTop - 60) + 'px', ''); + document.body.appendChild(div); + div.scrollIntoView({ behavior: 'smooth' }); - var $scrollHandler = new WCF.Effect.Scroll(); - $scrollHandler.scrollTo($option, true); - $option.focus(); + option.focus(); }, 200); {/if} }); -- 2.20.1