🐁🐛 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">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<!-- import the webpage's stylesheet -->
|
<!-- 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">
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
|
||||||
<!-- import the webpage's javascript file -->
|
<!-- 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>
|
<script src="/script.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Hi there!</h1>
|
<canvas id="confetti-holder"></canvas>
|
||||||
|
|
||||||
<p>
|
<div id="container">
|
||||||
I'm your cool new webpage. Made with <a href="https://glitch.com">Glitch</a>!
|
<p id="isit"></p>
|
||||||
</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>
|
<div class="glitchButton" style="position:fixed;top:20px;right:20px;"></div>
|
||||||
<script src="https://button.glitch.me/button.js"></script>
|
<script src="https://button.glitch.me/button.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
87
script.js
87
script.js
@ -1,9 +1,82 @@
|
|||||||
/* If you're feeling fancy you can add interactivity
|
var birthday = {
|
||||||
to your site with Javascript */
|
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
|
confetti.clear();
|
||||||
console.log("hi");
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(function() {
|
var confetti = {
|
||||||
alert('Hello, world!')
|
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 {
|
body {
|
||||||
font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;
|
width: 100%;
|
||||||
margin: 2em;
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
#confetti {
|
||||||
font-style: italic;
|
position: fixed;
|
||||||
color: #373fff;
|
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