我是新手,我正在尝试更多地考虑功能并清理我的代码 - 让它更干燥......我已经尝试将其用于悬停,它将无法正常工作。我知道我错过了一些简单易行的事情,但是......事先感谢你的帮助。
$('#phone').on({
mouseenter: function() {$(this).attr('src','../web-marketing/images/PhoneBlue.png')},
mouseleave: function() {$(this).attr('src','../web-marketing/images/Phone4.png')}});
$('#email').on({
mouseenter: function() {$(this).attr('src','../web-marketing/images/EmailBlue.png')},
mouseleave: function() {$(this).attr('src','../web-marketing/images/Email4.png')}});
$('#live-chat').on({
mouseenter: function() {$(this).attr('src','../web-marketing/images/ChatBoxBlue.png')},
mouseleave: function() {$(this).attr('src','../web-marketing/images/ChatBox4.png')}});
答案 0 :(得分:0)
请试试这个, 但请记住,手机,电子邮件和实时聊天必须是图片标签的ID
$('#phone').hover(
function () {$(this).attr('src','../web-marketing/images/EmailBlue.png');},
function () {$(this).attr('src','../web-marketing/images/Phone4.png');}
);
$('#email').hover(
function () {$(this).attr('src','../web-marketing/images/EmailBlue.png');},
function () {$(this).attr('src','../web-marketing/images/Email4.png');}
);
$('#live-chat').hover(
function () {$(this).attr('src','../web-marketing/images/ChatBoxBlue.png');},
function () {$(this).attr('src','../web-marketing/images/ChatBox4.png');}
);