how to use java script
Answer / fathimath thasneem
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Maximize Image Example</title>
<style>
.full-screen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
z-index: 9999;
}
#myImage {
width: 50%; /* Initially set to 50% of the container width */
cursor: pointer; /* Changes the cursor to a pointer to indicate it's clickable */
}
</style>
</head>
<body>
<img id="myImage" src="path_to_your_image.jpg" alt="Click to maximize">
<script>
const img = document.getElementById('myImage');
img.addEventListener('click', function() {
// Check if the image already has the full-screen class
if (img.classList.contains('full-screen')) {
img.classList.remove('full-screen'); // If yes, remove it (minimize)
} else {
img.classList.add('full-screen'); // Otherwise, add it (maximize)
}
});
</script>
</body>
</html>
| Is This Answer Correct ? | 0 Yes | 0 No |
write a programme to solve a formula for compound interest using html tags. I want to know how a formula containing degree (raise to the power) can be solved.
What is the difference between firstChild and firstElementChild?
How to change video files randomly after completing its execution in Javascript?
What does 3+4+"7" evaluate to?
Advantages & Disadvavtages of Java Script? Advantages & Disadvantages of CGI Scripting? Structure of Java Script? Commands of Java Script? HTML Basic Reviews?
What is the use of 'bind' method in JavaScript?
Javascript, Pass by Value or Pass by Reference?
What is a closure and how do you use it?
Methods get and post in html forms - what's the difference?
What javascript method would convert the string “20” to an integer (on the fly) so “20” + 20 = 40?
How do we add javascript onto a web page?
How to remove the event listener?