功能实现不了了,请各位帮忙看看是哪里错了,或者还有什么更简单的方法指点一下,谢谢
html代码:
<div id="mesage_p">
<a class="mesage_active" href="#vip">
<span class="mui-icon"><img src="../images/vip_a.png" alt="" /></span>
<span>会员中心</span>
</a>
<a>
<span class="mui-icon"><img src="../images/eye_n.png" alt="" /></span>
<span>量体预约</span>
</a>
<a>
<span class="mui-icon"><img src="../images/show_n.png" alt="" /></span>
<span>分享</span>
</a>
</div>
js代码:
$('#mesage_p a:nth-child(1)').on({
focus:function(){$(this).find('.mui-icon img').attr('src','../images/vip_a.png');},
blur:function(){$(this).find('.mui-icon img').attr('src','../images/vip_n.png');}
})
$('#mesage_p a:nth-child(2)').on({
focus:function(){$(this).find('.mui-icon img').attr('src','../images/eye_a.png');},
blur:function(){$(this).find('.mui-icon img').attr('src','../images/eye_n.png');}
})
$('#mesage_p a:nth-child(3)').on({
focus:function(){$(this).find('.mui-icon img').attr('src','../images/show_a.png');},
blur:function(){$(this).find('.mui-icon img').attr('src','../images/show_n.png');}
})
代码整理一下,用代码插件,不然你这个样子都不想看