I have a RFG setup and it is a gallery with a modal that opens when an image is clicked. The images are fine, when clicked they open the modal but instead of showing different text for each item, they only show the text of the last added item in the group.
Here is link:
hidden link
It is under "Featured Articles"
Here is the view code for loop item:
<div class="thumbnail"><a data-toggle="modal" data-target="#articlemodal" rel="noopener noreferrer">
<img src="[types field="article-image" output='raw'][/types]" alt="[types field="article-name"][/types]">
</a>
</div>
<!-- Modal -->
<div class="modal fade" id="articlemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">[types field="article-name"][/types]</h4>
</div>
<div class="modal-body">
<p>[types field="article-text"][/types]</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-lyrics" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="caption">[types field="article-name"][/types]</div>
Thanks
Looks like you are looping over multiple items but using the same ID in each loop. As a general rule in HTML, all ID attributes should be unique. Try adding the post ID -[wpv-post-id] into all repeating ID attributes. Then you must also add it to any trigger that points to an ID as a target or any aria-label that points to one of those IDs. Here's an update:
<div class="thumbnail"><a data-toggle="modal" data-target="#articlemodal-[wpv-post-id]" rel="noopener noreferrer">
<img src="[types field="article-image" output='raw'][/types]" alt="[types field="article-name"][/types]">
</a>
</div>
<!-- Modal -->
<div class="modal fade" id="articlemodal-[wpv-post-id]" tabindex="-1" role="dialog" aria-labelledby="myModalLabel-[wpv-post-id]">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel-[wpv-post-id]">[types field="article-name"][/types]</h4>
</div>
<div class="modal-body">
<p>[types field="article-text"][/types]</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-lyrics" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="caption">[types field="article-name"][/types]</div>
Perfect, great support as always! My issue is resolved now. Thank you!