Hero video mute/unmute button

Developer
Size
2,165 Kb
Views
8,096

How do I make an hero video mute/unmute button?

What is a hero video mute/unmute button? How do you make a hero video mute/unmute button? This script and codes were developed by [SHM] on 17 January 2023, Tuesday.

Hero video mute/unmute button Previews

Hero video mute/unmute button - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Hero video mute/unmute button</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <body>	<div class="video-background">	<video id="player" preload="none" poster="video/big-buck-bunny.jpg" autoplay="autoplay" loop="loop">	<source src="https://georgepaterson.github.io/jquery-videobackground/video/big-buck-bunny.mp4" type="video/mp4">	<source src="https://georgepaterson.github.io/jquery-videobackground/video/big-buck-bunny.webm" type="video/webm">	<source src="https://georgepaterson.github.io/jquery-videobackground/video/big-buck-bunny.ogv" type="video/ogg">	</video>	<div id="mute" class="btn"></div>	</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Hero video mute/unmute button - Script Codes CSS Codes

*{ margin: 0; padding: 0;
}
body{ height: 2500px;
}
.video-background{ height: 100vh; position: relative; margin: 0 !important; top: 0; width: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; overflow: hidden;
}
video{ margin: auto; position: absolute; top: 0%; left: 0%; transform: translate(0%, 0%); width: 100%;
/* height: auto; */
}
#mute{ cursor: pointer; height: 50px; width: 50px; position: absolute; top: 50px; right: 50px; border: 1px solid #000; background-size: cover;
}

Hero video mute/unmute button - Script Codes JS Codes

$(document).ready(function() {	if ($("video").prop('muted', false)){ $("#mute").css("background-image","url(http://image.flaticon.com/icons/svg/10/10430.svg)"); } $("#mute").click( function (){ if( $("video").prop('muted') ) { $("video").prop('muted', false); $("#mute").css("background-image","url(http://image.flaticon.com/icons/svg/10/10430.svg)"); } else { $("video").prop('muted', true); $("#mute").css("background-image","url(http://image.flaticon.com/icons/svg/10/10776.svg)"); } }); });
Hero video mute/unmute button - Script Codes
Hero video mute/unmute button - Script Codes
Home Page Home
Developer [SHM]
Username leon9208
Uploaded January 17, 2023
Rating 3
Size 2,165 Kb
Views 8,096
Do you need developer help for Hero video mute/unmute button?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

[SHM] (leon9208) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!