Skip to content

Instantly share code, notes, and snippets.

@moklick
Created September 24, 2017 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moklick/19bd97645c10e770e643407504b07333 to your computer and use it in GitHub Desktop.
Save moklick/19bd97645c10e770e643407504b07333 to your computer and use it in GitHub Desktop.
(function(){
// check browser support
if (!document.querySelectorAll || ![].forEach) {
return false;
}
// search teasers
var teasers = document.querySelectorAll('.teaser-leader-m');
[].forEach.call(teasers, function(d) {
// search link within teaser
var link = d.querySelector('.teaser__link__text');
// add click handler
d.addEventListener('click', function() {
var win = window.open(link, '_blank');
win.focus();
});
});
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment