Use the below code when you need to perform specific JS actions at certain screen sizes. The resize function is included incase someone resizes their window manually after page load.
jQuery(function($){
if(window.matchMedia('(max-width: 749px)').matches){
productGallery.css('height', productImage);
}
$( window ).resize(function() {
var productImage = $('.product__media-wrapper img').height();
if(window.matchMedia('(max-width: 749px)').matches){
productGallery.css('height', productImage);
} else {
productGallery.css('height', 'initial');
}
});
});