Skip to content

Instantly share code, notes, and snippets.

@sta1r
Created April 3, 2014 19:34
Show Gist options
  • Select an option

  • Save sta1r/9961244 to your computer and use it in GitHub Desktop.

Select an option

Save sta1r/9961244 to your computer and use it in GitHub Desktop.
Ryu demo (not my own), optimised
<div id="my-div"></div>
$(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'
})
});
#my-div {
width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment