I have a JS file with a single line of code, a console log:
console.log(guideImage);
The result of the above code is the element like this:
<img id="guideImage" class="Images" src="img/guide.png">
I expect that I should get an error because I haven't defined the guideImage
in the javascript file, Since I haven't selected the image via getElementById or something like that how we still can select the element?
This is confusing me!
In my CSS I have:
.containerGuideImage {
position: absolute;
overflow: hidden;
left: -1vw;
top: 55vh;
height: 42vh;
width: 11vw;
/*outline: 0.1vw dashed orange;*/
}
#guideImage{
position: absolute;
transform: scale(0.5, 0.5);
width: 12vw;
height:65vh;
opacity: 0;
top: -18vh;
}
.guideImageShow {
animation: guideImgShow 0.5s cubic-bezier(0.230, 1.000, 0.320, 1.000);
animation-delay: 0.3s;
animation-fill-mode: forwards ;
}
.guideImageHide {
animation: guideImgHide 0.4s cubic-bezier(0.785, 0.135, 0.15, 0.86);
animation-fill-mode: forwards ;
}
@-webkit-keyframes guideImgShow {
from { opacity: 0; right: 14vw }
to { opacity: 1; right: 0vw }
}
@-webkit-keyframes guideImgHide {
from { opacity: 1; left: 0vw }
to { opacity: 0; left: 14vw }
}
And HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="containerGuideImage">
<img id="guideImage" class="Images" src="img/guide.png"/>
</div>
<script src="script.js"></script>
</body>
</html>