The following code is a summary of what I'm trying to do, which is to develop a interface that allows the user to scroll left and right through images. Images start off the screen and then to the centre, and it also pushes the previous image back off the screen.
I would love some advice on the code I have or suggestions on how to do it better. Obviously, if the user rapidly clicks the arrows it will undoubtedly break the script, so I will need help here. Maybe prevent the arrows from being clicked when in a "load" state?
I should also mention that backgroundLoad preloads the next and previous image. And when I say "off screen" it will animate to the centre. I'm not looking for a image gallery/lightbox solution. This question is more about the preloading process.
var b = 0;
b = ini;
var num_loaded = 0;
imgArray[ini] = new Array();;
以上就是Implementing background loading properly and efficiently的详细内容，更多请关注web前端其它相关文章！