FrameWork/jQuery
[JQUERY] 이미지 롤오버
백룡화검
2009. 11. 17. 18:54
http://www.selfcontained.us/2008/03/08/simple-jquery-image-rollover-script/
$(function() {
$('.rollover').hover(function() {
var currentImg = $(this).attr('src');
$(this).attr('src', $(this).attr('hover'));
$(this).attr('hover', currentImg);
}, function() {
var currentImg = $(this).attr('src');
$(this).attr('src', $(this).attr('hover'));
$(this).attr('hover', currentImg);
});
});
<img src="first.gif" hover="second.gif" class="rollover"/>
$(function() {
$('.rollover').hover(function() {
var currentImg = $(this).attr('src');
$(this).attr('src', $(this).attr('hover'));
$(this).attr('hover', currentImg);
}, function() {
var currentImg = $(this).attr('src');
$(this).attr('src', $(this).attr('hover'));
$(this).attr('hover', currentImg);
});
});
<img src="first.gif" hover="second.gif" class="rollover"/>
|