how to use java script



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

Post New Answer

More JavaScript Interview Questions

Is javascript a highly secure scripting language?

0 Answers  


Which built-in method returns the index within the calling string object of the first occurrence of the specified value?

0 Answers  


How to you change the title of the page by javascript?

0 Answers  


WHAT IS .NET?

1 Answers  


What are the types of data types?

0 Answers  






What is spread operator?

0 Answers  


What are the different actions that are performed using javascript?

0 Answers  


how can we generate alert message without referashing page in asp.net with language vb.net and script use in java script .means with out referash the page message in java alert

0 Answers   NIC,


Explain the role of deferred scripts in javascript?

0 Answers  


What is arguments object in JavaScript?

0 Answers  


What is a null variable?

0 Answers  


Is an interface is a class?

1 Answers  


Categories