Switching an image using jQuery

后端 未结 7 1850
醉酒成梦
醉酒成梦 2021-02-01 23:29

Is there a better, more jQuery-ish way of handling this image substitution?

var image = $(obj).children(\"img\");
if ($(image).attr(\"src\") == \"Images/TreeColl         


        
7条回答
  •  难免孤独
    2021-02-02 00:30

    Possible alternatives:

    • Use toggleClass and put the images in stylesheet as background images.
    • Use 2 images and toggle them.

提交回复
热议问题