Sha256: c5f577305a48f6c589d687987124f56542bf7d6cee9dcc46d028791960e3f82a

Contents?: true

Size: 509 Bytes

Versions: 2

Compression:

Stored size: 509 Bytes

Contents

// This code is to implement skip_to_content

Blacklight.onLoad(function () {
  $(".skip-to-content").click(function(event) {
    event.preventDefault();
    // element to focus on
    let skipTo = '#' + $(this)[0].firstElementChild.hash.split('#')[1];

    // Setting 'tabindex' to -1 takes an element out of normal
    // tab flow but allows it to be focused via javascript
    $(skipTo).attr('tabindex', -1).on('blur focusout', function () {
      $(this).removeAttr('tabindex');
    }).focus();
  });
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyrax-2.9.2 app/assets/javascripts/hyrax/skip_to_content.js
hyrax-2.9.1 app/assets/javascripts/hyrax/skip_to_content.js