Tap to flip card - hopefully
This commit is contained in:
parent
bd183bf832
commit
30a5d53bc0
4
flip.js
Normal file
4
flip.js
Normal file
@ -0,0 +1,4 @@
|
||||
function flipCard() {
|
||||
document.getElementById('card-front').style.transform = 'rotateX(-180deg)';
|
||||
document.getElementById('card-back').style.transform = 'rotateX(0deg)';
|
||||
}
|
49
index.html
49
index.html
@ -5,27 +5,29 @@
|
||||
<title>Luke Else</title>
|
||||
<link rel="stylesheet" href="./style.css" />
|
||||
</head>
|
||||
<div class="card">
|
||||
<div class="card-back">
|
||||
<div class="line-numbers">
|
||||
<div>1</div>
|
||||
<div>2</div>
|
||||
<div>3</div>
|
||||
<div>4</div>
|
||||
<div>5</div>
|
||||
<div>6</div>
|
||||
<div>7</div>
|
||||
<div>8</div>
|
||||
<div>9</div>
|
||||
</div><code><span class="variable">const </span><span class="function">aboutMe </span><span class="operator">= </span><span>{</span>
|
||||
<div class="indent"> <span class="property">name</span><span class="operator">: </span><span class="string">'Luke Else'</span><span>,</span></div>
|
||||
<div class="indent"> <span class="property">title</span><span class="operator">: </span><span class="string">'Software Engineer + Student'</span><span>,</span></div>
|
||||
<div class="indent"> <span class="property">contact</span><span class="operator">: </span><span>{</span>
|
||||
<div class="indent"> <span class="property">email</span><span class="operator">: <a href="mailto:mail@luke-else.co.uk"></span><span class="string">'mail@luke-else.co.uk'</span></a><span>,</span></div>
|
||||
<div class="indent"><span class="property">website</span><span class="operator">:<a href="https://git.luke-else.co.uk/luke-else/"></span><span class="string">'https://git.luke-else.co.uk'</span></a></div><span>}</span>
|
||||
</div><span>}</span></code>
|
||||
|
||||
|
||||
<div class="card" id="card" onclick="flipCard()">
|
||||
<div class="card-back" id="card-back">
|
||||
<div class="line-numbers">
|
||||
<div>1</div>
|
||||
<div>2</div>
|
||||
<div>3</div>
|
||||
<div>4</div>
|
||||
<div>5</div>
|
||||
<div>6</div>
|
||||
<div>7</div>
|
||||
<div>8</div>
|
||||
<div>9</div>
|
||||
</div><code><span class="variable">const </span><span class="function">aboutMe </span><span class="operator">= </span><span>{</span>
|
||||
<div class="indent"> <span class="property">name</span><span class="operator">: </span><span class="string">'Luke Else'</span><span>,</span></div>
|
||||
<div class="indent"> <span class="property">title</span><span class="operator">: </span><span class="string">'Software Engineer + Student'</span><span>,</span></div>
|
||||
<div class="indent"> <span class="property">contact</span><span class="operator">: </span><span>{</span>
|
||||
<div class="indent"> <span class="property">email</span><span class="operator">: <a href="mailto:mail@luke-else.co.uk"></span><span class="string">'mail@luke-else.co.uk'</span></a><span>,</span></div>
|
||||
<div class="indent"><span class="property">website</span><span class="operator">:<a href="https://git.luke-else.co.uk/luke-else/"></span><span class="string">'https://git.luke-else.co.uk'</span></a></div><span>}</span>
|
||||
</div><span>}</span></code>
|
||||
</div>
|
||||
<div class="card-front">
|
||||
<div class="card-front" id="card-front">
|
||||
<div class="line-numbers">
|
||||
<div>1</div>
|
||||
<div>2</div>
|
||||
@ -38,6 +40,9 @@
|
||||
<div>9</div>
|
||||
</div><code><span class="variable">this</span><span>.</span><span class="method">addEventListener</span><span>(</span><span class="string">'mouseover'</span><span>, </span><span class="function">() => </span><span>{ </span>
|
||||
<div class="indent"><span class="variable">this</span><span>.</span><span class="property">flipCard </span><span>= </span><span class="boolean">true</span><span>;</span></div><span>});</span></code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
|
||||
<script src="./flip.js"></script>
|
||||
|
||||
</html>
|
13
style.css
13
style.css
@ -84,14 +84,13 @@
|
||||
color: #11181f;
|
||||
}
|
||||
|
||||
@media(hover: hover) and (pointer: fine) {
|
||||
.card:hover .card-front {
|
||||
transform: rotateX(-180deg);
|
||||
}
|
||||
.card:hover .card-back {
|
||||
transform: rotateX(0deg);
|
||||
}
|
||||
.card:hover .card-front{
|
||||
transform: rotateX(-180deg);
|
||||
}
|
||||
.card:hover .card-back{
|
||||
transform: rotateX(0deg);
|
||||
}
|
||||
|
||||
.card .line-numbers {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
Loading…
Reference in New Issue
Block a user