Skip to content

Instantly share code, notes, and snippets.

View alexsexton's full-sized avatar
🇪🇸

Alex Sexton alexsexton

🇪🇸
View GitHub Profile
@alexsexton
alexsexton / swap.js
Created October 4, 2019 15:03
Swap Image
/* globals jQuery, Modernizr */
'use strict'
jQuery(function ($) {
var productImageHover = function () {
if (!Modernizr.touchevents) {
// Using mouseenter / mouserleave incase of ajaxy stuff
$(document).on('mouseenter mouseleave', '.c-image img', function () {
var swapImg = this.getAttribute('data-swap-src')
var img = this.getAttribute('src')