I have an album component that then uses a bunch of image components for each image in the album. After the album is inserted it calls a lightbox function to lightbox the images. This is done on the parent element of the images to make you able to swipe and such between images. This works perfectly in the didInsertElement function of the album component when you go to the url of the album itself as the data from the backend is available as nested data in the album itself.
However, when I then show a list of albums and a user clicks one to show that particular album, the data for the images is loaded in an async fashion. This means that the didInsertElement event will fire before the images are available and thus the lightboxing doesn't work properly as the images don't exist in the dom yet.
What do you do in this case?
Aucun commentaire:
Enregistrer un commentaire