Skip to content

Instantly share code, notes, and snippets.

@Unripe01
Forked from jhonyspicy/mouseover.js
Created November 30, 2012 08:25
Show Gist options
  • Save Unripe01/4174505 to your computer and use it in GitHub Desktop.
Save Unripe01/4174505 to your computer and use it in GitHub Desktop.
マウスオーバー
//マウスオーバー用
$('.rollOver img').each(function() {
$(this).data('image_src', $(this).attr('src'));
$('<img>').attr('src', $(this).data('image_src').replace(/^(.+)(\.[a-z]+)$/, '$1_over$2')); //プリロード用
}).mouseover(function() {
$(this).attr('src', $(this).data('image_src').replace(/^(.+)(\.[a-z]+)$/, '$1_over$2'));
}).mouseout(function() {
$(this).attr('src', $(this).data('image_src'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment