Change the monogram to have one background image, which changes when a link is hovered
This commit is contained in:
parent
9f25e6d488
commit
1fe069b4f6
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 600 900" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<g id="Artboard1" transform="matrix(0.133333,0,0,0.1875,0,0)">
|
||||
<rect x="0" y="0" width="4500" height="4800" style="fill:none;"/>
|
||||
<clipPath id="_clip1">
|
||||
<rect x="0" y="0" width="4500" height="4800"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#_clip1)">
|
||||
<g transform="matrix(1,0,0,1,-6960,-6096)">
|
||||
<g transform="matrix(3.30882,0,0,2.35294,3710.74,3458.35)">
|
||||
<path d="M1662,1801L982,1121L982,1801L1662,1801Z" style="fill:rgb(35,31,32);"/>
|
||||
</g>
|
||||
<g transform="matrix(3.30882,0,0,2.35294,5960.74,3458.35)">
|
||||
<path d="M1662,1801L982,1121L982,1801L1662,1801Z" style="fill:rgb(35,31,32);"/>
|
||||
</g>
|
||||
<g transform="matrix(2.02607e-16,2.35294,-3.30882,1.44076e-16,15169.2,5385.41)">
|
||||
<path d="M1662,1801L982,1121L982,1801L1662,1801Z" style="fill:rgb(35,31,32);"/>
|
||||
</g>
|
||||
<g transform="matrix(3.30882,0,0,2.35294,3710.74,5058.35)">
|
||||
<path d="M1662,1801L982,1121L982,1801L1662,1801Z" style="fill:rgb(35,31,32);"/>
|
||||
</g>
|
||||
<g transform="matrix(3.30882,0,0,2.35294,3710.74,6658.35)">
|
||||
<path d="M1662,1801L982,1121L982,1801L1662,1801Z" style="fill:rgb(35,31,32);"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
65
index.html
65
index.html
|
|
@ -10,43 +10,12 @@
|
|||
|
||||
<div class="main">
|
||||
<div class="monogram">
|
||||
|
||||
<div class="column">
|
||||
<a href="#" class="triangle triangle-bottom">
|
||||
<img src="https://placekitten.com/300/300">
|
||||
<div class="triangle-label">Linguist</div>
|
||||
</a>
|
||||
|
||||
<a href="#" class="triangle triangle-bottom">
|
||||
<img src="https://placekitten.com/300/300">
|
||||
<div class="triangle-label">Quilter</div>
|
||||
</a>
|
||||
|
||||
<a href="#" class="triangle triangle-bottom">
|
||||
<img src="https://placekitten.com/300/300">
|
||||
<div class="triangle-label">Blog</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<a href="#" class="triangle triangle-bottom">
|
||||
<img src="https://placekitten.com/300/300">
|
||||
<div class="triangle-label multiline">Applied<br>Statistician</div>
|
||||
</a>
|
||||
|
||||
<a href="#" class="triangle triangle-top">
|
||||
<img src="https://placekitten.com/200/200">
|
||||
<div class="triangle-label">Knitter</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="intro">
|
||||
<div class="bio"> I'm <h1>Elizabeth Pankratz</h1>,<br>
|
||||
a <a href="#">linguist</a>,
|
||||
<a href="#">textile artist</a>,
|
||||
<br>
|
||||
and <a href="#">applied statistician</a>
|
||||
a <a class="linguist" href="#">linguist</a>,
|
||||
<a class="textileartist" href="#">textile artist</a>,
|
||||
and <a class="statistician" href="#">applied statistician</a>
|
||||
</div>
|
||||
<div class="links">
|
||||
<a href="#">about</a>
|
||||
|
|
@ -56,5 +25,33 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
const monogram = document.querySelector('.monogram');
|
||||
|
||||
const links = [
|
||||
{ element: document.querySelector('.intro a.linguist'), name: 'linguist' },
|
||||
{ element: document.querySelector('.intro a.statistician'), name: 'statistician' },
|
||||
{ element: document.querySelector('.intro a.textileartist'), name: 'textileartist' },
|
||||
];
|
||||
|
||||
const bgs = {
|
||||
linguist: 'http://placekitten.com/200/300',
|
||||
textileartist: 'http://placekitten.com/500/300',
|
||||
statistician: 'http://placekitten.com/200/400',
|
||||
};
|
||||
|
||||
links.forEach((link) => {
|
||||
console.log(link);
|
||||
link.element.addEventListener('mouseover', (event) => {
|
||||
monogram.style.backgroundImage = `url(${bgs[link.name]})`;
|
||||
});
|
||||
link.element.addEventListener('mouseout', (event) => {
|
||||
monogram.style.backgroundImage = 'none';
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
51
style.css
51
style.css
|
|
@ -40,52 +40,11 @@ body {
|
|||
/* Monogram */
|
||||
|
||||
.monogram {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.triangle {
|
||||
display: block; /* Because these are <a> tags */
|
||||
background-color: black;
|
||||
position: relative; /* Required for the absolute positioning of the triangle-label */
|
||||
width: 15vh;
|
||||
height: 15vh;
|
||||
max-width: 40vw;
|
||||
max-height: 40vw;
|
||||
}
|
||||
|
||||
.triangle-bottom {
|
||||
clip-path: polygon(0 0, 0 100%, 100% 100%);
|
||||
}
|
||||
|
||||
.triangle-top {
|
||||
clip-path: polygon(0 0, 0 100%, 100% 0);
|
||||
}
|
||||
|
||||
.triangle img {
|
||||
display: block; /* Prevents the annoying inline-block gap after */
|
||||
filter: grayscale(100%);
|
||||
mix-blend-mode: overlay;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.triangle:hover {
|
||||
background-color: hsl(50, 90%, 50%);
|
||||
}
|
||||
|
||||
.triangle-label {
|
||||
position: absolute;
|
||||
color: black;
|
||||
left: 0.5rem;
|
||||
bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.triangle-label.multiline {
|
||||
margin-top: -2rem;
|
||||
}
|
||||
|
||||
.triangle-top .triangle-label {
|
||||
top: 0.5rem;
|
||||
width: 20vw;
|
||||
height: 30vw;
|
||||
mask-image: url('assets/images/monogram.svg');
|
||||
background: black;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue