1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/javascripts/all-articles.js
Jason Etcovitch 7b31c08e16 "All articles" component of Actions landing page (#16318)
* Spike out all-articles.html

* Use it somewhere

* Do the thing

* Use 3 columns

* Increase space between links

* Hide standalone categories

* Move all-articles to bottom of product-landing

* Add obj_size filter

* Add buttons if numArticles > 10

* Add click event to show

* Add a chevron ^

* Assign maxArticles for some DRY fun

* Add some comments
2020-11-12 12:57:30 -05:00

19 lines
620 B
JavaScript

/**
* Handles the client-side events for `includes/all-articles.html`.
*/
export default function allArticles () {
const buttons = document.querySelectorAll('button.js-all-articles-show-more')
for (const btn of buttons) {
btn.addEventListener('click', evt => {
// Show all hidden links
const hiddenLinks = evt.currentTarget.parentElement.querySelectorAll('li.d-none')
for (const link of hiddenLinks) {
link.classList.remove('d-none')
}
// Remove the button, since we don't need it anymore
evt.currentTarget.parentElement.removeChild(evt.currentTarget)
})
}
}