Hello!
Im trying to make different images hover over different parts of text. I’m struggling to call the different images to the specific parts of the text that already exist in my txt.file
My code currently looks like this CSS in the index file:
.hover-title {
display: inline;
pointer-events: auto;
cursor: pointer;
}
.hover-image {
visibility: hidden;
}
body:not(.mobile) .hover-title:hover + .hover-image {
visibility: visible;
pointer-events: none;
}
.hover-image {
display: flex;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: -1;
pointer-events: none;
flex-direction: column;
align-items: center;
justify-content: center;
/* Change width and height to scale images */
width: 90vw;
height: 90vh;
}
.hover-image img {
max-width: 100% !important;
max-height: 100% !important;
width: auto !important;
height: auto !important;
margin-bottom: 0;
}
And the php in the template file looks like this:
<?php snippet('header') ?>
<main>
<?php snippet('intro') ?>
<div class="text">
<?= $page->text()->kt() ?>
<div class="hover-title">#1: CREAM CHEESE (YOUR CHOICE OF): PLAIN, DILL & CAPER, CHIVE, CASHEW NUT (+$1.0), HONEY & RICOTTA — $7.0</div>
<div class="hover-image"><?= $page->images()->first() ?></div>
</div>
<div class="hover-title">Image Hover Two</div>
<div class="hover-image">{image 2}</div>
</main>
<?php snippet('footer') ?>
Sorry for the mess, I’m new to this and need some help
Sam.