Code cleanup, following and gif support
This commit is contained in:
parent
493f56a052
commit
30954f3d3a
21 changed files with 318 additions and 123 deletions
|
|
@ -101,10 +101,32 @@ const hashChange = () => {
|
|||
}
|
||||
}
|
||||
|
||||
const swapImages = (e, mode) => {
|
||||
if (mode === 'gif') {
|
||||
const a = e.target
|
||||
const img = a.children[0]
|
||||
const gif = a.children[1]
|
||||
img.classList.add('hidden')
|
||||
gif.classList.remove('hidden')
|
||||
} else if (mode === 'img') {
|
||||
const gif = e.target
|
||||
const img = e.target.parentElement.children[0]
|
||||
img.classList.remove('hidden')
|
||||
gif.classList.add('hidden')
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('modal-background').addEventListener('click', hideModel, false)
|
||||
document.getElementById('modal-close').addEventListener('click', hideModel, false)
|
||||
document.getElementById('back-button').addEventListener('click', () => moveVideo(false))
|
||||
document.getElementById('next-button').addEventListener('click', () => moveVideo(true))
|
||||
window.addEventListener('hashchange', hashChange, false)
|
||||
|
||||
// Image hover
|
||||
const images = document.getElementsByClassName("clickable-img")
|
||||
for (let i = 0; i < images.length; i++) {
|
||||
images[i].addEventListener('mouseenter', e => swapImages(e, 'gif'), false)
|
||||
images[i].addEventListener('mouseout', e => swapImages(e, 'img'), false)
|
||||
}
|
||||
|
||||
hashChange()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue