opensanca/opensanca_jobs

View on GitHub
app/assets/javascripts/apply_to_job.js

Summary

Maintainability
A
0 mins
Test Coverage
window.App.ApplyToJob = {
  highlight_instructions(anchor_element) {
    $('html').animate({
      scrollTop: $(anchor_element).offset().top - 60
    }, 1000);

    anchor_element.classList.add("item-highlight");

    return setTimeout(() => anchor_element.classList.remove("item-highlight"), 5200);
  }
};

$(document).on("click", "[data-behavior~=apply-to-job]", function() {
  const anchor_element = document.getElementById(this.dataset.anchor);
  App.ApplyToJob.highlight_instructions(anchor_element);
  return false;
});