mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 20:46:26 +05:30
Happy New Year!
The ported version of Twenty Fifteen and Twenty Sixteen include with the package. Maintenance and bugs fixes.
This commit is contained in:
parent
767d43dbd0
commit
a273a4faf7
72 changed files with 17132 additions and 30 deletions
26
themes/twentyfifteen/js/skip-link-focus-fix.js
Normal file
26
themes/twentyfifteen/js/skip-link-focus-fix.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Makes "skip to content" link work correctly in IE9, Chrome, and Opera
|
||||
* for better accessibility.
|
||||
*
|
||||
* @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
|
||||
*/
|
||||
|
||||
( function() {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
|
||||
if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) &&
|
||||
document.getElementById && window.addEventListener ) {
|
||||
|
||||
window.addEventListener( 'hashchange', function() {
|
||||
var element = document.getElementById( location.hash.substring( 1 ) );
|
||||
|
||||
if ( element ) {
|
||||
if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName ) ) {
|
||||
element.tabIndex = -1;
|
||||
}
|
||||
|
||||
element.focus();
|
||||
}
|
||||
}, false );
|
||||
}
|
||||
} )();
|
||||
Loading…
Add table
Add a link
Reference in a new issue