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

What are types of javascript?

0 Answers  


Does apple use javascript?

0 Answers  


What can I build with javascript?

0 Answers  


Are there any training Institutions on iphone Automation testing?

0 Answers  


How to find radio button selection when a form is submitted?

0 Answers  


List some design patterns in javascript?

0 Answers  


The below script is working Internet browser but not working in mozilla plz find that good way... function doSubmit(op){ var rowcount=document.getElementsByName ("parameterTypeId").length; var parameterGrade; var performance; var goal; if(op == "save"){ for (var i=0; i < rowcount; i++) { var param=eval("document.forms [0].parameterGrade"+i); if(param.value != "select"){ return true; } } alert("Please rate atleast one attribute"); return false; }//if ends here

0 Answers  


What is the difference between test () and exec () methods?

0 Answers  


How to use one javascript function for multiple input fields?

0 Answers  


what is flux in javascript?

0 Answers  


Is javascript a security risk?

0 Answers  


Name some of the JavaScript features?

0 Answers  


Categories