Title: Dynamic page load
Last modified: April 2, 2024

---

# Dynamic page load

 *  Resolved [pomponpafraise](https://wordpress.org/support/users/pomponpafraise/)
 * (@pomponpafraise)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/dynamic-page-load/)
 * Hello ! I really like your work with this plugin implementation thank you very
   much 🙂 
   I’m having a question, is there a quick and easy way to make the plugin
   work after a dynamic dom change ? On the website i’m working on I load the content
   of the page dynamically with javascript. I’d love to get a way to update the 
   photoswipe data after each page load
 * thank you 🙂
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdynamic-page-load%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Arno Welzel](https://wordpress.org/support/users/awelzel/)
 * (@awelzel)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/dynamic-page-load/#post-17547278)
 * The plugin already handles DOM changes in the frontend. So whenever a new image
   link is added or existing links get removed, the frontend will update the image
   collection used for PhotoSwipe (see [https://github.com/arnowelzel/lightbox-photoswipe/blob/5.2.5/src/js/frontend.js#L473-L494](https://github.com/arnowelzel/lightbox-photoswipe/blob/5.2.5/src/js/frontend.js#L473-L494)).
 * However, all image links added to the page need to contain the neccessary `data-
   lbwps-` attributes (at least `data-lbwps-width` and `data-lbwpws-height` which
   is needed to tell PhotoSwipe the size of the final image). I don’t know how you
   add the images technically – but since you may already use backend code to provide
   the images, you may add these attributes in the backend side before adding the
   images in the frontend or add the image links with these attributes set (the 
   size must be the size of the image in the lightbox, PhotoSwipe will use this 
   to build the image frame in the lightbox and to determine if zooming is possible
   or not).
 * To get an idea how this is done in existing posts/pages, see here: [https://github.com/arnowelzel/lightbox-photoswipe/blob/5.2.5/src/LightboxPhotoSwipe/LightboxPhotoSwipe.php#L630-L637](https://github.com/arnowelzel/lightbox-photoswipe/blob/5.2.5/src/LightboxPhotoSwipe/LightboxPhotoSwipe.php#L630-L637)
    -  This reply was modified 2 years, 2 months ago by [Arno Welzel](https://wordpress.org/support/users/awelzel/).
 *  Thread Starter [pomponpafraise](https://wordpress.org/support/users/pomponpafraise/)
 * (@pomponpafraise)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/dynamic-page-load/#post-17548394)
 * i’m a bit confused because when I compare the source code of the page generated
   with and without a dynamic load and it’s the same. there is no “`data-lbwps-`”
   attribute anywhere and I don’t know how I should add those. I’m a too bad developper
   to figure out what’s wrong but thank you for you answer 🙂
 *  Thread Starter [pomponpafraise](https://wordpress.org/support/users/pomponpafraise/)
 * (@pomponpafraise)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/dynamic-page-load/#post-17548435)
 * oh, it’s now working there was no link to the media file in the admin -_-
   but
   for some reasons it was working on invidual image with a “classic” page load.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Dynamic page load’ is closed to new replies.

 * ![](https://ps.w.org/lightbox-photoswipe/assets/icon-256x256.png?rev=2906302)
 * [Lightbox with PhotoSwipe](https://wordpress.org/plugins/lightbox-photoswipe/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/lightbox-photoswipe/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/lightbox-photoswipe/)
 * [Active Topics](https://wordpress.org/support/plugin/lightbox-photoswipe/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/lightbox-photoswipe/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/lightbox-photoswipe/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [pomponpafraise](https://wordpress.org/support/users/pomponpafraise/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/dynamic-page-load/#post-17548435)
 * Status: resolved