Created
April 13, 2014 11:52
-
-
Save lutsen/10580836 to your computer and use it in GitHub Desktop.
Swap a "main" image by hovering over a thumb image.
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
// Swap a "main" image by hovering over a thumb image. | |
// They both need to have the same scr, except for the "template" part. | |
$(function () { | |
$( '.thumbimg' ).each( function (i) { | |
$( this ).on({ | |
mouseenter: function() { | |
$('#mainimg').attr( | |
'src', | |
$( this ).attr('src').replace('fit164x164', 'fit555x555') // Replace the template part in the src | |
); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment