Skip to content

Instantly share code, notes, and snippets.

@AntonTrollback
Last active March 7, 2016 15:53

Revisions

  1. AntonTrollback revised this gist Jan 7, 2015. 3 changed files with 39 additions and 18 deletions.
    18 changes: 0 additions & 18 deletions futlines.js
    Original file line number Diff line number Diff line change
    @@ -1,18 +0,0 @@
    // Tested in IE8 and Firefox
    //
    // Along with this css:
    // a:active { outline: none }
    // a:focus { outline: 1px dotted }

    $(function() {

    $(document).on({
    'mousedown' : function(e) {
    $(this).css('outline', 'none');
    },
    'mouseup' : function(e) {
    $(this).css('outline', '').blur();
    }
    }, 'a, button, input[type="submit"]');

    });
    16 changes: 16 additions & 0 deletions index.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    a {
    color: rebeccapurple;
    text-decoration: none;
    outline: 0;
    }

    a:hover,
    a:active {
    color: rebeccapurple;
    text-decoration: underline;
    }

    html.tabbing a:focus {
    outline: 2px solid;
    text-decoration: none;
    }
    23 changes: 23 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    $(function() {

    var $root = $('html');
    var tabbing, code;

    $(document).on('mousedown keydown', function (e) {
    if (e.type === 'mousedown') {
    tabbing = false;
    return;
    }

    code = e.keyCode ? e.keyCode : e.which;

    if (code == 9) {
    tabbing = true;
    }
    });

    $('a, button, input[type="submit"]').on('focus', function (e) {
    $root.toggleClass('tabbing', tabbing);
    });

    });
  2. AntonTrollback created this gist Mar 11, 2013.
    18 changes: 18 additions & 0 deletions futlines.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    // Tested in IE8 and Firefox
    //
    // Along with this css:
    // a:active { outline: none }
    // a:focus { outline: 1px dotted }

    $(function() {

    $(document).on({
    'mousedown' : function(e) {
    $(this).css('outline', 'none');
    },
    'mouseup' : function(e) {
    $(this).css('outline', '').blur();
    }
    }, 'a, button, input[type="submit"]');

    });