Skip to content

Commit e515aec

Browse files
committed
add class to links on all cards
1 parent 3d6a7d4 commit e515aec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/js/70-docs-ndl.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ document.addEventListener('DOMContentLoaded', function () {
1212
a.classList.add('banner-link')
1313
})
1414

15+
// add a class to the link itself for tracking
16+
document.querySelectorAll('.cards .link a').forEach(function (a) {
17+
a.classList.add('card-link')
18+
})
19+
1520
// if a card is 'selectable' then make it a click target
1621
// by taking the link from the card and wrapping the whole card in an anchor tag with that link
1722
// if the card contains more than one link, the first link is used
@@ -30,11 +35,6 @@ document.addEventListener('DOMContentLoaded', function () {
3035
e.preventDefault()
3136
window.location.href = target
3237
})
33-
34-
// add a class to the link itself for tracking
35-
link.querySelectorAll('a').forEach(function (a) {
36-
a.classList.add('card-link')
37-
})
3838
})
3939
}
4040

0 commit comments

Comments
 (0)