A Pen by Alastair Mucklow on CodePen.
Created
April 3, 2014 19:34
-
-
Save sta1r/9961244 to your computer and use it in GitHub Desktop.
Ryu demo (not my own), optimised
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="my-div"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| var ryuBox = $('#my-div') | |
| ryuBox.html('<img src="http://i.imgur.com/90Mmdcm.png">') | |
| var ryu = ryuBox.find('img') | |
| ryu.hover( function() { | |
| this.src = 'http://i.imgur.com/nTj3Fxx.gif' | |
| }, function() { | |
| this.src = 'http://i.imgur.com/90Mmdcm.png' | |
| }) | |
| ryu.mousedown( function() { | |
| $('.demo-hadouken').remove(); | |
| this.src = 'http://i.imgur.com/Rfj0a80.png' | |
| ryuBox.append( | |
| '<img class="demo-hadouken" src="http://i.imgur.com/oTyQRvX.gif">' | |
| ); | |
| $('.demo-hadouken').animate( { | |
| "margin-left": "800px" | |
| }, 600, 'swing', function() { | |
| this.remove(); | |
| }); | |
| }) | |
| ryu.mousedown(function() { | |
| //$('audio')[0].load(); | |
| //$('audio')[0].play(); | |
| }) | |
| ryu.mouseup(function() { | |
| this.src = 'http://i.imgur.com/nTj3Fxx.gif' | |
| }) | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #my-div { | |
| width: 100%; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment