Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

If a user is trying to scroll horizontally, we can get the delta and get the scroll direction. Find the column width of the next/prev column and update the scroll property. An implementation can look like:

const nextColumnIndex = scrollDeltaX < 0 ? Math.max(0, columnStart - 1) : Math.min(columnStart, columnCount - 1);

const columnWidth = getColumnWidth( nextColumnIndex );

scrollBar.scrollLeft += (scrollDeltaX < 0 ? -1 : 1) * columnWidth;



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: