javascript - adding Picture dynamically to Photoswipe -


i trying add pictures(from array) dynamically photoswipe. have tried use "append" method of jquery without success.i readed people wrote issue on web did not find rigth answer.any helps welcome.

i found way add images dynamically photoswipe, bit hackish.

there 3 tings 1 must do:

  1. update originalimages (dont know how importent is).
  2. add click handlers images.
  3. add images instance.cache.images.

i did following code:

        var images, image, i, metadata, src,caption,         util =window.code.util;         images=$('#addedimages').find('a');         instance.originalimages = $('#all-photo-swipe-images').find('.a');         (i = 0; < images.length; i++) {             image = images[i];             src = instance.settings.getimagesource(image);             caption = instance.settings.getimagecaption(image);             metadata = instance.settings.getimagemetadata(image);             image.__photoswipeclickhandler = photoswipe.ontriggerelementclick.bind(instance);             util.events.remove(image, 'click', image.__photoswipeclickhandler);             util.events.add(image, 'click', image.__photoswipeclickhandler);             image = new photoswipe.image.imageclass(image, src, caption, metadata);             instance.cache.images.push(image); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -