Improved scrolling to search result
authorAlexander Ebert <ebert@woltlab.com>
Tue, 3 Jan 2017 16:58:19 +0000 (17:58 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 3 Jan 2017 16:58:19 +0000 (17:58 +0100)
wcfsetup/install/files/acp/templates/option.tpl

index c1b2b4d51d46266e20ee07812517a1bb5a32a76d..6de4f3d26419ae1fcd76f970fd17065bc00b8476 100644 (file)
@@ -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}
        });