Mark Schultheiss
Mark Schultheiss

Reputation: 34217

jQuery UI Autocomplete scroll to top if type more text

I have a jQuery autocomplete working against my testbox just fine except when I type, get a set of resultss, scroll down a bit, then type more words (new result) the new result stays scrolled to the same poistion as the old result set.

Is there an easy way that I am missing to force the autocmplete result list to scroll to top prior to returning new results?

Upvotes: 2

Views: 2981

Answers (1)

Oleg
Oleg

Reputation: 222007

I hope that the usage $('.ui-menu').scrollTop(0); inside of search will solve your problem. The following code seams me even better:

$("#myinput").autocomplete({
    // ... other parameters which you use
    search: function () {
        $(this).data("autocomplete").menu.element.scrollTop(0);
    }
});

Upvotes: 4

Related Questions