-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select box smooth scrolls to current item when opening #93
Comments
It looks like calling |
Thanks! |
I didn't like my previous idea. Went with the above change. This also uses a new this.tomSelect.dropdown_content.style.scrollBehavior = 'auto';
optionElement = this.tomSelect.getOption(value);
this.tomSelect.dropdown_content.scrollTop += (optionElement.offsetTop - elemTop);
this.tomSelect.dropdown_content.style.scrollBehavior = 'smooth'; you could do this optionElement = this.tomSelect.getOption(value);
var scrollTop = this.tomSelect.dropdown_content.scrollTop + (optionElement.offsetTop - elemTop);
this.tomSelect.scroll( scrollTop, 'auto'); Gonna test a little more tomorrow |
ok, I like how things are working. Should be all set with 1.7.2! |
fab; thanks. We'll give it a go! |
Describe the bug
In a long dropdown, the currently selected item is scrolled-to when opening the dropdown. This is wanted behaviour, but if the dropdown was previously scrolled there's an animation from the old position to the selected item position.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Open opening at step 6 the dropdown should be centred about the selected item already without any motion.
Additional context
Version: 1.7.1
The text was updated successfully, but these errors were encountered: