Skip to content

Instantly share code, notes, and snippets.

@donaldallen
Created February 17, 2017 21:43
Show Gist options
  • Save donaldallen/248d37b0e33bcab493f7cd1ddd071f0a to your computer and use it in GitHub Desktop.
Save donaldallen/248d37b0e33bcab493f7cd1ddd071f0a to your computer and use it in GitHub Desktop.
<a href="/contact">Contact me</a>
<script>
const link = document.querySelector("a");
link.addEventListener("mouseenter", () => {
const css = "<link rel=preload as=style href=contact.css>";
document.head.insertAdjacentHTML("beforesend", css);
}, {
once: true
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment