how to use java script

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between firstChild and firstElementChild?

751


hi i want validations for two drop down lists. when user enter to second list by skipping first list alert box should appear. drop down validation Please choose an item from the drop down menu:

Choose a username:
Choose a username:
please any body help me thanks

1873


How do you change the style/class on any element?

715


How to use external JavaScript file?

739


What does question mark mean in react?

639


What are the scopes of a variable in javascript?

714


What is the dollar sign in javascript?

637


What is escape() function?

693


hi iM rahul.my questions is my project is a web based & developed using java,jsp. when i record it using qtp what script i will get like either browser("jdfjkf").page("nkf").... or javawindow("f d ").javaedit("Dasf").... plz clarify my doubt asap and i also need some vbscipt of java coding?

1894


What is event bubbling and capturing in javascript?

689


What is the purpose of local variables?

615


Is javascript object oriented?

665


Why javascript is dangerous?

682


Write the code for adding new elements dynamically?

769


How to set the cursor to wait?

650