Within my project, there are 4 sets of videos all loading simultaneously, but only one is visible at a time. Users have the ability to switch to the next/previous videos by using arrow keys. I am interested in implementing fade in/out transitions on these videos every time a user moves to the next/previous video.
I attempted to utilize Vue transitions, however, I am unsure how to integrate them with v-show
instead of v-if
. The challenging aspect is that all videos render only once and are never removed; they simply become hidden. Below is the HTML code for these videos:
<div class="video-container" v-show="currentVideo === 1">
<video @ended="countLoop" ref="video1" muted autoplay>
<source src="../assets/videos/video1.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
</div>
<div class="video-container" v-show="currentVideo === 2">
<video @ended="countLoop" ref="video2" muted>
<source src="../assets/videos/video2.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
</div>
<div class="video-container" v-show="currentVideo === 3">
<video @ended="countLoop" ref="video3" muted>
<source src="../assets/videos/video3.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
</div>
<div class="video-container" v-show="currentVideo === 4">
<video @ended="countLoop" ref="video4" muted>
<source src="../assets/videos/video4.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
</div>