当第三个div悬停时,我正在尝试替换两个不同div的图像链接。我怎么能这样做因为我的jquery不正确而且不简洁。我确实意识到我不能把这个加倍。哈特哈哈。任何帮助,将不胜感激。谢谢。
$('#minerallink').hover(function() { // On mouseenter
$('#brainicon, #stomachicon').stop(true, true).fadeOut(function() { // Fade out the image, and when done
$(this).attr('src', 'health-tips/images/images/medicineman-icons-dark_01.png', ).fadeIn();
$(this).attr('src', 'health-tips/images/images/medicineman-icons-dark_04.png').fadeIn(); // Change its source and fade in
});
$('#manpic5').stop(true, true).fadeOut(function() { // Fade out the image, and when done
$(this).attr('src', 'health-tips/images/images/medicineman-dark_05.png').fadeIn(); // Change its source and fade in
});
},
function() { // On mouseleave - reverse the process
$('#brainicon, #stomachicon').stop(true, true).fadeOut(function() {
$(this).attr('src', 'health-tips/images/images/medicineman-icons_01.png').fadeIn();
$(this).attr('src', 'health-tips/images/images/medicineman-icons_04.png').fadeIn();
});
$('#manpic5').stop(true, true).fadeOut(function() {
$(this).attr('src', 'health-tips/images/images/medicineman_05.png').fadeIn();
});
});
答案 0 :(得分:0)
将2个ID分开:
$('#stomachicon').stop(true, true).fadeOut(function() {
$(this).attr('src', 'health-tips/images/images/medicineman-icons-dark_04.png').fadeIn();
});
$('#brainicon').stop(true, true).fadeOut(function() {
$(this).attr('src', 'health-tips/images/images/medicineman-icons-dark_01.png', ).fadeIn();
});
并为其余
执行此操作