]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed input field and tipsy positioning in singleselect
authorVincent Petry <pvince81@owncloud.com>
Thu, 31 Oct 2013 09:50:18 +0000 (10:50 +0100)
committerVincent Petry <pvince81@owncloud.com>
Thu, 31 Oct 2013 09:50:18 +0000 (10:50 +0100)
If the user scrolls or the window is resized, the formerly cached offset
was wrong. This fix makes sure the offset is re-read before showing the
input field.

core/js/singleselect.js

index 0b7fc20a8f03a72a550b891fbf0ebea3b70977ef..e2d94a9f2875c333afa8cdde4b14bbdd5517af1e 100644 (file)
@@ -7,11 +7,7 @@
                                input.attr('title', inputTooltip);
                        }
                        select = $(select);
-                       if ($.fn.tipsy){
-                               input.tipsy({gravity: 'n', trigger: 'manual'});
-                       }
                        input.css('position', 'absolute');
-                       input.css(select.offset());
                        input.css({
                                'box-sizing': 'border-box',
                                '-moz-box-sizing': 'border-box',
                                        select.data('previous', value);
                                } else {
                                        event.stopImmediatePropagation();
+                                       // adjust offset, in case the user scrolled
+                                       input.css(select.offset());
                                        input.show();
                                        if ($.fn.tipsy){
+                                               input.tipsy({gravity: 'n', trigger: 'manual'});
                                                input.tipsy('show');
                                        }
                                        select.css('background-color', 'white');