I am facing an issue regarding the positioning of components. I have four images, and when you hover over them, a specific component is displayed as shown below:
https://i.sstatic.net/gybcy.png
For example, hovering over a yellow image will display a different component below it, and so on for all images.
The problem arises when the screen size reaches 568 pixels, i.e., the mobile version. In this case, I need to adjust the position of the displayed components because currently in the mobile version, they appear like this:
https://i.sstatic.net/wjenA.png
You can see that all the components are displayed at the bottom, but I need them to be situated below each respective image.
In other words, I want them to look like this:
https://i.sstatic.net/rJcVk.png
You can view the code on codesandbox
App.vue
<template>
<div>
<div class="enjoy_headline_container">
<div class="EnjoyGirlsContainer">
<div>
<h3>Shrink the screen to 568 pixels or lower to see the problem</h3>
</div>
<div class="EnjoyGirlsList">
<div
v-for="(chunk, index) in Math.ceil(EnjoyGirlsList.length / 2)"
:key="'chunk-' + index"
:class="'wrap-' + index"
>
<div
v-for="(item, index) in EnjoyGirlsList.slice(
(chunk - 1) * 2,
chunk * 2
)"
:key="'img-' + index"
class="EnjoyCard"
:class="'EnjoyCard-' + index"
>
<div>
<img
@mouseover="mouseOver(item, (hover = true))"
v-bind:src="item.imagePath"
alt="Snow"
/>
</div>
<div class="EnjoyCardContainer">
<div
:style="{ background: item.textColor }"
class="EnjoyCardChildContainer"
>
<h3 class="EnjoyCardChildContainerTitleName">
{{ item.titleName }}
</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="EnjoyGirlsHoverEffect">
<div
class="HoverLogic"
@mouseleave="mouseout(enjoy, (hover = false))"
v-for="(enjoy, index) in EnjoyGirlsList"
:key="index"
>
<div class="EnjoyGirlsChildHoverEffect">
<component
v-show="enjoy.hovered"
v-bind:is="enjoy.componentName"
></component>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import EnjoyBlue from "./components/EnjoyBlue";
import EnjoyGreen from "./components/EnjoyGreen";
import EnjoyYellow from "./components/EnjoyYellow";
import EnjoyRed from "./components/EnjoyRed";
export default {
name: "HomePage",
components: {
EnjoyRed,
EnjoyYellow,
EnjoyGreen,
EnjoyBlue,
},
data() {
return {
homePageImageList: [
{
imageURL:
"http://astragem.com/static/images/MenuGirl/HomePageBackground/15-min.png",
},
{
imageURL:
"http://astragem.com/static/images/MenuGirl/HomePageBackground/15-min.png",
},
{
imageURL:
"http://astragem.com/static/images/MenuGirl/HomePageBackground/15-min.png",
},
],
hover: false,
sectionGirlsListComponentsNames: [
"EnjoyRed",
"EnjoyYellow",
"EnjoyGreen",
"EnjoyBlue",
],
EnjoyGirlsList: [
{
imagePath:
"https://lh3.googleusercontent.com/_0OiZeWgElIETUMZW8B9wEZR-V0BLMyDBHfK6hdYQVGzsryLQAZ0GEL9_PDi5NlzmpK8bETuJcZ0CtUQKnErvs36Xw=w640-h400-e365-rj-sc0x00ffffff",
titleName: "TEENS",
textColor: "#74C8C5",
hovered: false,
componentName: "EnjoyBlue",
},
{
imagePath:
"https://p0.piqsels.com/preview/32/831/578/leaf-malina-garden-nature-thumbnail.jpg",
titleName: "MINXES",
textColor: "#76ED00",
hovered: false,
componentName: "EnjoyGreen",
},
{
imagePath:
"https://dandelionmarketing.com/wp-content/uploads/2020/01/yellow-09.jpg",
titleName: "MILFS",
textColor: "#FFE600",
hovered: false,
componentName: "EnjoyYellow",
},
{
imagePath:
"http://pm1.narvii.com/6691/30c6c5246b1aee0e676f741f63ab144bbdb77da2_00.jpg",
titleName: "COUGARS",
textColor: "#CC003D",
hovered: false,
componentName: "EnjoyRed",
},
],
};
},
methods: {
mouseOver: function (enjoy) {
this.EnjoyGirlsList.forEach((enjoy) => (enjoy.hovered = false));
enjoy.hovered = true;
},
mouseout: function (enjoy) {
enjoy.hovered = false;
},
},
};
</script>
EnjoyBlue
<template>
<p>Blue Component</p>
</template>
EnjoyGreen
<template>
<p>Green Component</p>
</template>
EnjoyYellow
<template>
<p>Yellow Component</p>
</template>
EnjoyRed
<template>
<p>Red Component</p>
</template>