🐁🐛 Checkpoint
./index.html:7435365/1848 ./style.css:7435365/834 ./script.js:7435365/2247
This commit is contained in:
parent
36109cf9be
commit
e44cd7b3ad
13
index.html
13
index.html
@ -7,21 +7,20 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- import the webpage's stylesheet -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Kanit:700i&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
|
||||
<!-- import the webpage's javascript file -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||
<script src="/confetti.js" defer></script>
|
||||
<script src="/script.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hi there!</h1>
|
||||
<canvas id="confetti-holder"></canvas>
|
||||
|
||||
<p>
|
||||
I'm your cool new webpage. Made with <a href="https://glitch.com">Glitch</a>!
|
||||
</p>
|
||||
<div id="container">
|
||||
<p id="isit"></p>
|
||||
</div>
|
||||
|
||||
<!-- include the Glitch button to show what the webpage is about and
|
||||
to make it easier for folks to view source and remix -->
|
||||
<div class="glitchButton" style="position:fixed;top:20px;right:20px;"></div>
|
||||
<script src="https://button.glitch.me/button.js"></script>
|
||||
</body>
|
||||
|
87
script.js
87
script.js
@ -1,9 +1,82 @@
|
||||
/* If you're feeling fancy you can add interactivity
|
||||
to your site with Javascript */
|
||||
var birthday = {
|
||||
now: null,
|
||||
day: 25,
|
||||
month: 6, // June
|
||||
match: false,
|
||||
check: function() {
|
||||
this.now = new Date();
|
||||
if (this.now.getDate() == this.day && this.now.getMonth() + 1 == this.month) this.activate()
|
||||
else this.deactivate()
|
||||
},
|
||||
activate: function() {
|
||||
document.getElementById('isit').innerHTML = "Yes!"
|
||||
elementClass.remove(document.getElementById('isit'), 'nope')
|
||||
elementClass.add(document.getElementById('isit'), 'yep')
|
||||
confetti.render();
|
||||
},
|
||||
deactivate: function() {
|
||||
document.getElementById('isit').innerHTML = "No"
|
||||
elementClass.remove(document.getElementById('isit'), 'yep')
|
||||
elementClass.add(document.getElementById('isit'), 'nope')
|
||||
|
||||
// prints "hi" in the browser's dev tools console
|
||||
console.log("hi");
|
||||
confetti.clear();
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
alert('Hello, world!')
|
||||
})
|
||||
var confetti = {
|
||||
displayed: false,
|
||||
confetti: null,
|
||||
target: 'confetti-holder',
|
||||
max: null,
|
||||
size: 1,
|
||||
animate: true,
|
||||
props: ['circle', 'square', 'triangle', 'line'],
|
||||
colors: [[165,104,246], [230,61,135], [0,199,228], [253,214,126]],
|
||||
clock: 25,
|
||||
rotate: true,
|
||||
width: null,
|
||||
height: null,
|
||||
render: function() {
|
||||
this.width = window.innerWidth
|
||||
this.height = window.innerHeight
|
||||
this.max = Math.floor(this.width * this.height / 1799.04)
|
||||
if (this.confetti) this.confetti.clear();
|
||||
|
||||
this.confetti = new ConfettiGenerator(this)
|
||||
this.confetti.render();
|
||||
this.displayed = true;
|
||||
},
|
||||
clear: function() {
|
||||
if (!this.displayed) return;
|
||||
|
||||
this.confetti.clear();
|
||||
this.displayed = false;
|
||||
}
|
||||
}
|
||||
|
||||
var elementClass = {
|
||||
has: function(e, c) {
|
||||
return !!e.className.match(new RegExp('(\\s|^)' + c + '(\\s|$)'));
|
||||
},
|
||||
add: function(e, c) {
|
||||
if (!this.has(e,c)) e.className += " " + c;
|
||||
},
|
||||
remove: function(e, c) {
|
||||
if (this.has(e,c)) {
|
||||
var r = new RegExp('(\\s|^)' + c + '(\\s|$)');
|
||||
e.className=e.className.replace(r, ' ');
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
birthday.check();
|
||||
};
|
||||
|
||||
window.addEventListener('resize', function() {
|
||||
if (confetti.displayed) confetti.render();
|
||||
}, false);
|
||||
|
||||
window.setInterval(function(){
|
||||
birthday.check();
|
||||
}, 5000);
|
||||
|
46
style.css
46
style.css
@ -1,11 +1,43 @@
|
||||
/* CSS files add styling rules to your content */
|
||||
|
||||
html,
|
||||
body {
|
||||
font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;
|
||||
margin: 2em;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-style: italic;
|
||||
color: #373fff;
|
||||
#confetti {
|
||||
position: fixed;
|
||||
top:0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#container p {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
margin: 0;
|
||||
padding: 1vw;
|
||||
font-family: 'Kanit', sans-serif;
|
||||
font-size: 16vw;
|
||||
}
|
||||
|
||||
p.nope {
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
p.yep {
|
||||
background-image: linear-gradient(to right, violet, indigo, blue, green, yellow, orange, red);
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
color: transparent;
|
||||
}
|
Loading…
Reference in New Issue
Block a user