-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (22 loc) · 722 Bytes
/
script.js
File metadata and controls
25 lines (22 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const scroll = new LocomotiveScroll({
el: document.querySelector('#main'),
smooth: true
});
// var a = document.querySelector("#elem1")
// var image = a.getAttribute("data-image")
// console.log(image)
var elemC = document.querySelector("#elem-container")
var fixed = document.querySelector("#fixed-image")
elemC.addEventListener("mouseenter",function(){
fixed.style.display = "block"
})
elemC.addEventListener("mouseleave",function(){
fixed.style.display = "none"
})
var elems = document.querySelectorAll(".elem")
elems.forEach(function(e){
e.addEventListener("mouseenter", function(){
var image = e.getAttribute("data-image")
fixed.style.backgroundImage = `url(${image})`
})
})