<!DOCTYPE html> <html> <head> <title>Climate Change Video Player</title> <!-- inter bold…
- Usercode
<div class="top-headings"> <h1 class="heading">Climate Change Video Player</h1> </div> - Assistant
<div class="top-headings">
<h1 class="heading">Climate Change Video Player</h1>
</div>
To add a Stop button at the bottom left corner of your page, you'll need to include a button element in your HTML and use CSS to position it appropriately. Here are the steps to achieve this:
Insert the following HTML code just before the closing </body> tag in your HTML file:
<!-- Stop Button -->
<button id="stop-button">Stop</button>
Your updated HTML should look like this:
<!DOCTYPE html>
<html>
<head>
<title>Climate Change Video Player</title>
<!-- inter bold -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="container">
<div class="top-headings">
<h1 class="heading">Climate Change Video Player</h1>
</div>
<div class="cc-images" id="cc-images"></div>
</div>
<!-- Stop Button -->
<button id="stop-button">Stop</button>
<script type="text/javascript" src="./MagicPlanetWebClient.js"></script>
<script src="videoPlayer.js"></script>
</body>
</html>
To position the button at the bottom left corner, add the following CSS rules to your index.css file:
#stop-button {
position: fixed;
bottom: 10px; /* Adjust the distance from the bottom */
left: 10px; /* Adjust the distance from the left */
padding: 10px 20px;
font-size: 16px;
background-color: #f44336; /* Red background */
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#stop-button:hover {
background-color: #d32f2f; /* Darker red on hover */
}
Alternatively, if you prefer to include the style directly in your HTML file, add the following <style> block inside your <head> section:
<head>
<!-- Existing head content -->
<!-- Stop Button Styles -->
<style>
#stop-button {
position: fixed;
bottom: 10px;
left: 10px;
padding: 10px 20px;
font-size: 16px;
background-color: #f44336;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
#stop-button:hover {
background-color: #d32f2f;
}
</style>
</head>
If you want the Stop button to perform an action, such as stopping a video playback, you'll need to add an event listener in your videoPlayer.js file. Here's how you can do it:
// videoPlayer.js
// Wait for the DOM to load
document.addEventListener('DOMContentLoaded', function() {
const stopButton = document.getElementById('stop-button');
stopButton.addEventListener('click', function() {
// Replace the following line with the code to stop your video player
stopVideoPlayback();
});
});
// Function to stop video playback
function stopVideoPlayback() {
// Assuming you're using a video element with id 'myVideo'
const video = document.getElementById('myVideo');
if (video) {
video.pause(); // Pause the video
video.currentTime = 0; // Reset to start
}
// If you're using a different video player library,
// use its API to stop/reset the video playback.
}
Make sure to replace 'myVideo' with the actual ID of your video element, and adjust the code according to the video player you're using.
By adding a button element to your HTML and styling it with CSS, you can place a Stop button at the bottom left corner of your page. Adding JavaScript functionality allows the button to perform actions when clicked.
Note: Adjust the padding, font size, colors, and positioning values (bottom, left) in the CSS to suit your design preferences.
Not yet included in a published release.