Swipe icon indicating copy to clipboard operation
Swipe copied to clipboard

SwipeJS consumed too much memory if the div number is large

Open jychunyih opened this issue 9 years ago • 0 comments

Did a quick test, if we have 200 div (images) to slide, the memory usage is 150M which is really too high for mobile device.

For lots of swipe scenario, 3 slides are enough to fulfill the job. We just create "prev", "curr", "next" 3 slides and add loading logic to switch source among these 3 slides. The effect is the same to use 200 slides but the memory usage really drops significantly.

To accomplish this task, current swipe.js has one issue: If we set Options.continuous to true, we cannot stop at ad-hoc slide as we want.

So I made a fix in my project to add below logic in transitionEnd event:

if (isValidSlide && !isPastBounds && !(direction && container.RightPastRounds) && !(!direction && container.LeftPastRounds))

Developer can specify container.RightPastRounds or container.LeftPastRounds to control stop right or left swipe manually then.

Will propose a change request.

jychunyih avatar May 20 '15 02:05 jychunyih