To better explain my question i created simplified jsfiddle example.
When selecting “a array” from dropdown menu and then selecting “b array” and scrolling down first 5 elements are loaded from “b array” then all unloaded elements from “a array” and only then rest of “b array” but instead only “b array” elements should show up.
My question is how to get rid of previously selected array elements getting loaded in div?
EDITED:
This is my first attempt to write something in javascript so sorry everyone for eye burning from looking at my code and thanks for help – @ThiefMaster suggested unbind works for me
The problem is that the old
scrollevents stay bound. You need to unbind them.A quick fix would be using
instead of
Demo (also removed the
evalcrap): http://jsfiddle.net/ThiefMaster/6gX8z/8/