Smart-select scroll to selected value

Would anyone happen to know how to scroll to the input value of a selected item of a smart select auto init when the window appears? I cannot get the position of the selected value to scroll to.
thanks :slight_smile:

This can help to get the required elements:

$$(document).on('smartselect:opened', (e) => {
  var ss = e.detail
  var selectedItems = ss.$containerEl.find('input:checked');
  var pageContent = ss.$containerEl.find('.page-content'); // available in popup/page/sheet
  // scroll page content to selected items
})

Hi Vladimir, and thanks for answering :slight_smile:
I’ve tried that…I always get a position of “0”

I have a smart-select ‘popover’ from 1 to 30 items with closeOnSelect enabled (non-multiple).
When the user clicks and selects 15 the popover closes. When clicked again, it defaults to the top instead of the selected 15. I’ve tried settimeout to allow the popover to appear before reading the position, but all positions display “0”.

thanks
eric

Can you show the code how you detect the position?

…That’s the thing, I cant find the position?!?
not matter what i use to find the position of the selected item, i get value ZERO
ex: $(selectedItems)[0].scrollHeight

thanks!

Hi
I can’t get this to work.
What’s wrong her:

https://codepen.io/henning-johnsen/pen/YzNXYgb?editors=1011