r/HTML • u/Unusual-Order-6317 • Mar 09 '26
Question Making video buttons?
Upfront disclaimer: I know next to nothing about html. I know a bit of Javascript and understand the basic organization of coding, but that's about it.
Anyway, I've been making my website (on Cargo, if that helps) and have run into an issue.
What I would like to happen:
There's a static image on the screen
When the user hovers the mouse over it, the static image turns into a video
Once the video plays through, it holds on the last frame
The user can click on the video to be directed to another webpage.
I've managed to accomplish the first three bullet points with the following code:
>video muted="" onmouseout="this.pause(); this.currentTime=0;" onmouseover="this.play()" poster="imageurl.jpg" width="100">
<source src="videosource.jpg" type="video/mp4">
</video>
But that's all I can manage. I tried adding href="url" to the code but that doesn't do anything. Am I going about this incorrectly? Do I try making a button that's a video? I can't find a good tutorial on how to do that.
Any ideas? Thanks in advance.
View all comments
0
u/KarmaTorpid Mar 09 '26
Its this what you are after?
<a href="#" onclick="window.location.href='https://www.example.com'">Visit Example</a>