I'm very new to html and especially javascript so I'm not very good when it comes to this stuff yet.
I've been trying to make a html page for my friend that shows a interactive advent calendar. I would like the page to only show the boxes for a certain day (So on the 12th only show the 12th box) and the previous ones.
First I hoped to get a solution to do that, but since I've been failing with it since hours I'm okay with just being able to open those now...
My problem now is that when scrolling down to the second box, it takes me to the beginning on the page (Firefox), and I'm able to open the boxes that should be locked. So I hoped someone could help me with this as this is my christmas gift to my friend who has been trying to teach me html since a bit.
My cards look like this in html
<div class="calendar">
<div onclick="checkdate(1)">
<div class="scene scene--card">
<div class="card">
<div class="card__face card__face--front i1"></div>
<div class="card__face card__face--back">
<span>Header</span><br><br>Text
</div>
</div>
</div>
</div>
<div onclick="checkdate(2)">
<div class="scene scene--card">
<div class="card">
<div class="card__face card__face--front i2"></div>
<div class="card__face card__face--back">
<span>Header</span><br><br>Text
</div>
</div>
</div>
</div>
</div>
And my script to find the right boxes looks like this
function checkdate(selectday) {
var dateselect = new Date (2020, 10, selectday);
var card = document.querySelector('.card');
var datenow = new Date();
if (datenow > dateselect) {
$('.scene').select(function() {
$(".card", this).toggleClass("is-flipped")});
} else {
alert ("No cheating!");
}
}
Sorry if I forgot something or did something wrong, this is my first post. Let me know if that's the case please!
Edit 1
Here's a fiddle with everything related to the calendar!