Skip to content

Instantly share code, notes, and snippets.

@DeadWisdom
Created February 21, 2013 22:37
Show Gist options
  • Save DeadWisdom/5009038 to your computer and use it in GitHub Desktop.
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.
$(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