Last active
February 27, 2018 17:44
-
-
Save willbroderick/77fbd826eff23ac84cb37ca3f01f323a to your computer and use it in GitHub Desktop.
Show featured image on page load, not selected variant image - Symmetry Sections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// vvvvv COPY THIS TO THE BOTTOM OF THEME.JS.LIQUID vvvvv | |
// select featured image on page load, ignoring variant image | |
$(document).on('optionate', 'select[name="id"]', function(){ | |
var $this = $(this); | |
setTimeout(function(){ | |
if(!$this.closest('.product-detail').find('.option-selectors select option[value=""]').length) { | |
$this.closest('.product-detail').find('.gallery .thumbnails a:first').trigger('click'); | |
} | |
}, 10); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment