fel_website/themes/felicie/static/js/slideshow.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-05-16 17:58:00 +00:00
window.onload = function(){
// close on esc key
document.addEventListener('keydown', function(event){
if(event.keyCode === 27){
closeModal()
}
});
}
// Close the Modal
function closeModal() {
document.getElementById("slide-container").style.display = "none"
elems = document.getElementsByClassName('slide')
for(let i=0; i<elems.length; i++){
elems[i].style.display = "none"
}
document.getElementsByTagName("header")[0].style.opacity = 1
document.getElementById("a-propos").style.opacity = 1
document.getElementById("telecharger").style.opacity = 1
2020-05-16 17:58:00 +00:00
}
function showSlide(id){
closeModal()
2020-05-16 17:58:00 +00:00
isOpen = true
document.getElementById('slide-container').style.display = "block"
document.getElementById(id).style.display = "block"
// change persistent elements' opacity
document.getElementsByTagName("header")[0].style.opacity = 0.2
2020-06-01 11:43:08 +00:00
document.getElementById("a-propos").style.opacity = 0.2
document.getElementById("telecharger").style.opacity = 0.2
2020-05-16 17:58:00 +00:00
goToTop()
}
// When the user clicks on an image, scroll to the top
function goToTop() {
document.body.scrollTop = 0 // safari
document.documentElement.scrollTop = 0 // Chrome, Firefox, IE and Opera
}