Hi everyone,

lately I've implemented an auto completion textfield at the bottom of a 
form. I was a bit bothered by the fact that the user would potentially 
need to scroll down in order to see all the options offered by the auto 
completion. I couldn't find any information on how to auto scroll to the 
auto completion list with bulit-in functionality so I modified 
controls.js a tiny bit.

I'm posting the patch here in order to hear how I should have done it 
without to touching the source or of course to get the patch 
incorporated into future releases.

Greetings from Cologne, Germany,
Niels.
--- controls.js.old	2005-12-15 00:25:12.000000000 +0100
+++ controls.js	2005-12-15 00:25:27.000000000 +0100
@@ -61,6 +61,13 @@
         Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
       }
       Effect.Appear(update,{duration:0.15});
+
+      var scrollToAutoComplete = function () {
+        offsets = Position.cumulativeOffset(element);
+        window.scrollTo(offsets[0], offsets[1]);
+      };
+      setTimeout(scrollToAutoComplete, 150);
+
     };
     this.options.onHide = this.options.onHide || 
     function(element, update){ new Effect.Fade(update,{duration:0.15}) };
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to