Opening an overlay in mobile devices automatically scrolls to top
authorAlexander Ebert <ebert@woltlab.com>
Mon, 27 May 2013 01:13:16 +0000 (03:13 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 27 May 2013 01:13:16 +0000 (03:13 +0200)
wcfsetup/install/files/js/WCF.js

index 30a665d80f8958ae24a545fc7b364596fe2aaf95..dfebe12c00fdd26eeb9322264cf07c365bc75d16 100755 (executable)
@@ -8387,6 +8387,12 @@ $.widget('ui.wcfDialog', {
         * Renders this dialog, should be called whenever content is updated.
         */
        render: function() {
+               // check if this if dialog was previously hidden and container is fixed
+               // at 0px (mobile optimization), in this case scroll to top
+               if (!this._container.is(':visible') && this._container.css('top') === '0px') {
+                       window.scrollTo(0, 0);
+               }
+               
                // force dialog and it's contents to be visible
                this._container.show();
                this._content.children().show();