Autofocus in horizontal scrolling

I have a horizontal scrollable div with list items. It looks like below. I want the list to be autofocused when the user clicks on any list item. The list item is currently in place. Is there a way in Javascript or jQuery to autofocus a list item?

Below are the CSS that I used to create this horizontal scroll div

on ul

white-space: nowrap;
 overflow-x: auto;

on li

display: inline-block !important;
    float: none;

Horizontal list

+4
source share
2 answers

You can try this, $ (YourElement) .trigger ("focus").

0
source

, $(YourElement).click(); : css "YourElement".

0

All Articles