jQuery attr() change img src

前端 未结 2 807
南笙
南笙 2021-02-13 16:06

I\'m making some Rocket launching effect by jQuery. When I click on Rocket, it\'ll swap with another rocket image, and then launch up. When I click \"Reset\" link, Rocket must r

2条回答
  •  别那么骄傲
    2021-02-13 16:42

    1. Function imageMorph will create a new img element therefore the id is removed. Changed to

      $("#wrapper > img")

    2. You should use live() function for click event if you want you rocket lanch again.

    Updated demo: http://jsfiddle.net/ynhat/QQRsW/4/

提交回复
热议问题