Skip to content Skip to sidebar Skip to footer

Is It So Bad To Have Heaps Of Elements In Your Dom?

I am making a real estate non interactive display for their shop window. I have kicked jCarousel into doing what I want: Add panels per AJAX Towards the end of the current set, go

Solution 1:

Could you reuse old elements instead of removing them and adding new ones ?

Solution 2:

I worked out a fix that ended up being very simple!

Simply pass this to the config for jCarousel

itemFirstOutCallback: {
               onAfterAnimation: function(carousel, li, index, state) {
                 if (state === 'init') return;

                 carousel.remove(index); 

               }
            }

Basically, this just removes the list element as soon as it becomes invisible (scrolled into negative overflow: hidden territory, if you will :) )

Post a Comment for "Is It So Bad To Have Heaps Of Elements In Your Dom?"