Slow results with removeAllImages()

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

Hi,

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:

	$('.ad-controls').empty();
	$('.ad-thumb-list').empty();	
	$('.ad-preloads').remove();

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

Coordinator
May 17, 2012 at 6:31 PM

Hi,

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 12:53 PM

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