Skip to content

Instantly share code, notes, and snippets.

@choncou
Created February 17, 2019 19:28
Show Gist options
  • Save choncou/9785deba91c1d4fe47cbdd08fef2f219 to your computer and use it in GitHub Desktop.
Save choncou/9785deba91c1d4fe47cbdd08fef2f219 to your computer and use it in GitHub Desktop.
$(document).on('turbolinks:load', () => {
linkableElements = $('.js-linkable');
linkableElements.click((e) => {
e.preventDefault();
const { delegateTarget } = e;
const href = $(delegateTarget).data('href');
Turbolinks.visit(href);
});
linkableElements.mouseover((e) => {
$(e.delegateTarget).css('cursor', 'pointer');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment