关于淡入/淡出时的图像替换的Jquery悬停功能
Jquery hover function regarding image replacement on fadein/fadeout
当第三个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();
});
});
像这样拆分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();
});
并对其余执行此操作
相关文章:
- 使用javascript的图像替换循环
- 是否可以仅通过jQuery将图像替换为用户动态选择的另一个图像
- 用图像替换SVG
- 将href中的图像替换为其他元素中的图像
- 错误时用图像替换视频
- 以编程方式将fabric-js-canvas的图像替换为hq图像,并重新计算其他对象的坐标和大小
- jQuery 图像替换为类
- 可以用我自己的自定义图像替换光标
- jQuery-图像替换转换〔Safari中的问题〕
- d3.js用图像替换节点
- 用图像替换页面,而不是添加图像
- 可以动态设置图像替换文本吗
- JQuery - 单击时将背景图像替换为另一个背景图像
- 将鼠标悬停在另一个图像上时,将图像替换为另一个图像
- HTML:用图像替换文本微笑
- 将所有图像替换为一个图像 Javascript
- 在 jquery 中使用类和 ID 将一个图像替换为另一个图像
- 如何用自定义图像替换脸书按钮
- 在 PHP 中将一个外部图像替换为另一个内部图像
- 将图像替换为另一个图像,然后在超时后再次替换 - Javascript