rewrite graph.js in coffeescript
This commit is contained in:
parent
60e18e2636
commit
08d9421dd9
|
@ -1,10 +0,0 @@
|
|||
function initGraphNav() {
|
||||
$(".graph svg").css("position", "relative");
|
||||
$("body").bind("keyup", function(e) {
|
||||
if(e.keyCode == 37) { // left
|
||||
$(".graph svg").animate({ left: "+=400" });
|
||||
} else if(e.keyCode == 39) { // right
|
||||
$(".graph svg").animate({ left: "-=400" });
|
||||
}
|
||||
});
|
||||
}
|
10
app/assets/javascripts/graph.js.coffee
Normal file
10
app/assets/javascripts/graph.js.coffee
Normal file
|
@ -0,0 +1,10 @@
|
|||
initGraphNav = ->
|
||||
$('.graph svg').css 'position', 'relative'
|
||||
|
||||
$('body').bind 'keyup', (e) ->
|
||||
if e.keyCode is 37 # left
|
||||
$('.graph svg').animate left: '+=400'
|
||||
else if e.keyCode is 39 # right
|
||||
$('.graph svg').animate left: '-=400'
|
||||
|
||||
window.initGraphNav = initGraphNav
|
Loading…
Reference in a new issue