I'm trying to create a popup modal for links to the attribute images
Here is the code on our attribute template. (testing this with not required radio attributes on a "developer" PROD page template)
<mvt:if expr="l.settings:option:image">
<a href="&mvte:option:image;" class="button product-attributes-image-button black bg-lt-gray">View Image</a>
<div class="row mfp-hide attribute-image"><img src="&mvte:option:image;" class="js-attribute-image" data-image="&mvte:option:image;" data-index="&mvt:global:counter;" alt="&mvte:option:prompt;" title="&mvte:option:prompt;" /></div>
</mvt:if>
I have already set up the position counter and it is working properly. Just can't figure out how to link the data-index to the jquery in the scripts file
Here is whats in the scripts file
// ---- Open attribute images ---- //
$('.product-attributes-image-button').magnificPopup({
items: {
src: $('.js-attribute-image').attr('data-image'),
index: $('.js-attribute-image').attr('data-index')
},
type: 'image',
});
Any help would be greatly appreciated
Thanks
Here is the code on our attribute template. (testing this with not required radio attributes on a "developer" PROD page template)
<mvt:if expr="l.settings:option:image">
<a href="&mvte:option:image;" class="button product-attributes-image-button black bg-lt-gray">View Image</a>
<div class="row mfp-hide attribute-image"><img src="&mvte:option:image;" class="js-attribute-image" data-image="&mvte:option:image;" data-index="&mvt:global:counter;" alt="&mvte:option:prompt;" title="&mvte:option:prompt;" /></div>
</mvt:if>
I have already set up the position counter and it is working properly. Just can't figure out how to link the data-index to the jquery in the scripts file
Here is whats in the scripts file
// ---- Open attribute images ---- //
$('.product-attributes-image-button').magnificPopup({
items: {
src: $('.js-attribute-image').attr('data-image'),
index: $('.js-attribute-image').attr('data-index')
},
type: 'image',
});
Any help would be greatly appreciated
Thanks
Comment