Slow results with removeAllImages()

May 17, 2012 at 2:59 PM
Edited May 17, 2012 at 3:03 PM


First of all: great gallery!

I'm filling the gallery dynamically with different images, which works fine so far, thanks for adding some new methods in 1.2.7 to help with that. I tried using the new remove/add methods, but I bumped into some troubles with them:

The removeAllImages() method is repeatedly calling removeImage() which is really slow (at least for me, it takes >1 second). I'm getting much faster results (few millisecs) with my previous approach, which is clearing the DOM:


and then initializing the AD-gallery again

   gallery = $('.ad-gallery').adGallery(..);

Maybe this info is useful to you. My question is: do you know a better way to do this?

Cheers & Thanks

May 17, 2012 at 7:31 PM


Thanks for the feedback. You're absolutely right, removeAllImages really shouldn't be calling removeImage, it should just clear the gallery. I'm a bit surprised that it takes a whole second per image though.

Your solution should work well for now, I'll optimize removeAllImages in a coming release.

Jun 4, 2012 at 1:53 PM

please help me.. how can I call removeAllImages inside another function ? ( for example function clearAll (id) { $('div').click(function(){ removeAllImages } }) ???