Remove updlicate ids

This commit is contained in:
Hanzei 2018-07-01 13:08:26 +02:00
parent 015b4bbd41
commit 0d6371f6eb
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
2 changed files with 4 additions and 4 deletions

View file

@ -15,7 +15,7 @@
{{ else }} {{ else }}
<div class="column is-one-third"> <div class="column is-one-third">
{{ end }} {{ end }}
<div id="project-{{ $index }}" class="card"> <div class="card" data-target="#project-{{ $index }}">
<div class="card-image"> <div class="card-image">
<figure class="image is-3by2"> <figure class="image is-3by2">
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}> <a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
@ -60,7 +60,7 @@
</section> </section>
{{ end }} {{ end }}
</div> </div>
<button class="modal-close is-large" aria-label="close"></button> <button class="modal-close is-large" aria-label="close" data-target="#project-{{ $index }}"></button>
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -10,10 +10,10 @@ $('a[href^="#"]').click(function(e) {
// Modal closer // Modal closer
$('.card').click(function () { $('.card').click(function () {
$('#'+this.id+'.modal').addClass('is-active'); $($(this).attr('data-target')).addClass('is-active');
}); });
$('.modal-close').click(function () { $('.modal-close').click(function () {
$('#'+$(this).parent('.modal').get(0).id+'.modal').removeClass('is-active'); $($(this).attr('data-target')).removeClass('is-active');
}); });
$(document).keypress(function(e) { $(document).keypress(function(e) {
if(e.which == 0) { if(e.which == 0) {