forked from hyohyo0803/DYStudy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
952 B
27 lines
952 B
// SNS리스트 호버 이벤트(백그라운드 이미지) |
|
const snsKind = ['insta', 'face', 'blog', 'youtube'] |
|
const ON = "on" |
|
const OFF = "off" |
|
|
|
// listArray = 리스트 DOM이 담긴 배열 |
|
const snsBg = (listArray) => { |
|
if (listArray) { |
|
listArray.forEach((element, index, array) => { |
|
element.style.background = `url('./main/icon/sns_${snsKind[index]}_${OFF}.png') no-repeat` |
|
}) |
|
} |
|
} |
|
const mouseEnter = (listArray) => { |
|
listArray.forEach((element, index, array) => { |
|
element.addEventListener('mouseenter', () => { |
|
element.style.background = `url('./main/icon/sns_${snsKind[index]}_${ON}.png') no-repeat` |
|
}) |
|
}) |
|
} |
|
const mouseLeave = (listArray) => { |
|
listArray.forEach((element, index, array) => { |
|
element.addEventListener('mouseleave', () => { |
|
element.style.background = `url('./main/icon/sns_${snsKind[index]}_${OFF}.png') no-repeat` |
|
}) |
|
}) |
|
} |