Created
February 21, 2013 22:37
-
-
Save DeadWisdom/5009038 to your computer and use it in GitHub Desktop.
Simple javascript that blurs out all the links that have href="#" when you hold down the apple key (change it to something else if you don't like it). Requires jQuery, imagine that.
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() { | |
function getColor(item){ | |
var rgb = $(item).css('color'); | |
return rgb.substring(4, rgb.length - 1); | |
} | |
$(window).keydown(function(e) { | |
if (e.keyCode == 224) { | |
$('a[href=#]').each(function(i, element) { | |
var item = $(element); | |
var color = getColor(item); | |
item.data('color', color); | |
item.css('color', 'rgba(' + color + ', .2)'); | |
item.css('text-shadow', 'rgb(' + color + ') 0 0 2px'); | |
}); | |
} | |
}); | |
$(window).keyup(function(e) { | |
if (e.keyCode == 224) { | |
$('a[href=#]').each(function(i, element) { | |
var item = $(element); | |
var color = item.data('color'); | |
item.css('color', 'rgba(' + color + ', 1)'); | |
item.css('text-shadow', 'none'); | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment