Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
168 views

Find closest elements in an array relative to given index with a bias to distance from index and direction

This function determines which images should be loaded based on which image is currently in the viewport (array index), what direction the user is scrolling, and if the image has yet to be loaded. It ...
dandan's user avatar
  • 155
3 votes
1 answer
70 views

Calculating direction based on index of array

I am comparing the index of the current component displayed in the viewport against an array of all the components on the screen to determine to direction the user in scrolling. Does this function ...
dandan's user avatar
  • 155
6 votes
1 answer
1k views

Challenge: solution for this deep-iteration JavaScript function dilemma?

Trying to implement a deep-iteration function with some constraints, I've noticed the faster solution is iterating it twice! Any attempt to avoid this resulted in slower code. So, the challenge: can ...
MaiaVictor's user avatar
  • 1,101