如果我有10个图片,我需要做鼠标对,鼠标出来,并使用点击改变图像和在第二次点击返回回来,,但没有任何特殊的id任何图像?你能帮忙吗!
发布于 2015-12-25 04:25:51
你可以用“这个”选择器
$('img').hover(function(){
    // Code to do when is mouse over (Mouse Enter)
    $(this).attr("src", urlImage);
},function(){
    // Code to do (Mouse Leave)
    $(this).attr("src", AnotherUrlImage);
});这是单击切换图像的正确脚本。
$("img").one("click", click1);
function click1() {
    $(this).attr("src", "URLIMAGE2");
    $(this).one("click", click2);
}
function click2() {
    $(this).attr("src", "URLIMAGE2");
    $(this).one("click", click1);
}https://stackoverflow.com/questions/34459463
复制相似问题