rework of zoom functionality

This commit is contained in:
Clément Brossaud
2023-05-13 15:14:10 +02:00
parent 3ae501508d
commit 4fdf61e62d
3 changed files with 13 additions and 10 deletions

View File

@@ -8,7 +8,7 @@
<link rel="stylesheet" href="src/css/style.css">
<link rel="stylesheet" href="src/css/navbar.css">
<link rel="stylesheet" href="src/css/footer.css">
<script src="src/js/index/index.js" defer></script>
<script type="module" src="src/js/index/index.js" defer></script>
</head>
<body>
<div class="navbar">

View File

@@ -1,10 +1,8 @@
var imgAnalyse = document.getElementById("img_analyse");
function zoom(img){
img.setAtribute("width", "width*2px")
img.setAtribute("height", "height*2px")
var width = parseInt(img.getAttribute("width"));
var height = parseInt(img.getAttribute("height"));
img.setAttribute("width", width * 2)
img.setAttribute("height", height * 2)
}
addEventListener("mouseover", zoom(imgAnalyse));
export { zoom };

View File

@@ -1,6 +1,11 @@
import { zoom } from "./index.js";
function main() {
zoom();
addEventListener("mouseover", zoom(imgAnalyse));
var imgAnalyse = document.getElementById("img_analyse");
zoom(imgAnalyse);
imgAnalyse.addEventListener("mouseover", function() {
zoom(imgAnalyse);
});
}
main();