Skip to content

Commit

Permalink
slider trigger is ctrl on linux, alt everywhere else
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Florit committed Mar 16, 2012
1 parent 5cdd6e9 commit 1872a04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 1 addition & 2 deletions data/chord.txt
@@ -1,8 +1,7 @@

// chord diagram from http://mbostock.github.com/d3/ex/chord.html
// colors from the twilight theme: http://bit.ly/wufWv1

// click the pulsing red numbers and hold down the alt key!

var chord = d3.layout.chord()
.padding(0.05)
.sortSubgroups(d3.descending)
Expand Down
13 changes: 10 additions & 3 deletions js/water.js
Expand Up @@ -168,17 +168,24 @@ slider.slider({
}
});

// use control key on linux, alt key everywhere else
var sliderKey = navigator && navigator.platform && navigator.platform.toLowerCase().indexOf('linux') != -1
? 'ctrl' : 'alt';

// display slider key on page
$('#sliderKey').text(sliderKey);

// trigger slider on control
$('textarea').bind('keydown.alt', function(e) {
$('textarea').bind('keydown.' + sliderKey, function(e) {
// are we on a token?
if (onNumeric) {
slider.css('visibility', 'visible');
}
}).bind('keyup.alt', function(e) {
}).bind('keyup.' + sliderKey, function(e) {
slider.css('visibility', 'hidden');
});

$('#slider').bind('keyup.alt', function(e) {
$('#slider').bind('keyup.' + sliderKey, function(e) {
slider.css('visibility', 'hidden');
});

Expand Down
2 changes: 1 addition & 1 deletion water.html
Expand Up @@ -61,7 +61,7 @@
</div>
<div id="slider"></div>
<div id='instructions'>
click a number and hold down the alt key
click a number and hold down the <span id='sliderKey'></span> key
</div>
<div id='aboutAndAttribution'>
<a id='about' href='blog-water'>what is this?</a>
Expand Down

0 comments on commit 1872a04

Please sign in to comment.