Skip to content

Commit dc2079e

Browse files
author
Andrew
committed
Change the collapsible icon on click
1 parent 5a78e0e commit dc2079e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/assets/javascripts/assets.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function changeIconOnClick() {
2+
$('#accordion h5 a').click(function(e){
3+
var card = $(e.target).closest('div.card');
4+
var img = $('i', card)[0];
5+
6+
if (img.classList.contains('fa-plus')) {
7+
img.classList.remove('fa-plus');
8+
img.classList.add('fa-minus');
9+
} else {
10+
img.classList.remove('fa-minus');
11+
img.classList.add('fa-plus');
12+
}
13+
});
14+
}
15+
16+
document.addEventListener('turbolinks:load', changeIconOnClick);

0 commit comments

Comments
 (0)