Skip to content

Instantly share code, notes, and snippets.

@dcneiner
Created July 26, 2010 20:36
Show Gist options
  • Save dcneiner/491188 to your computer and use it in GitHub Desktop.
Save dcneiner/491188 to your computer and use it in GitHub Desktop.
a:after {
...
content: attr(title); /* Default to title */
...
};
html.js a:after {
...
content: attr(data-title); /* Shift to data-title */
...
};
jQuery(function ($) {
$('html').addClass('js'); // add .js to the html element
// Take existing titles and move them to data-title instead
$('a').each(function (i,el) {
$(this).attr('data-title', this.title)
.attr('title', ''); // empty out title
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment