Files
tripwithbonus/static/js/global_js.js
2023-10-18 17:36:55 +03:00

72 lines
1.9 KiB
JavaScript

// $(document).ready(function (){
// middleWareJS()
// })
// window.onfocus = function () {
// getSocketState()
// }
window.onload = function (){
middleWareJS()
}
function middleWareJS(){
let footer = document.querySelector("footer")
let body = document.body.style;
if (document.querySelector(".block-list-of-users")){
footer.style.display = "none"
} else {
footer.style.display = ""
}
}
document.addEventListener('DOMContentLoaded', function() {
let img = document.getElementById('dropbtn_lang')
if (window.location.href.indexOf("ru") > -1){
img.style.background = "url('/static/img/png/ru.png')"
img.style.backgroundRepeat = "no-repeat"
img.style.backgroundPosition = "left center"
}else if(window.location.href.indexOf("en") > -1){
img.style.background = "url('/static/img/png/en.png')"
img.style.backgroundRepeat = "no-repeat"
img.style.backgroundPosition = "left center"
}
});
window.addEventListener('scroll', () => {
// let headerBG = document.getElementById('header_bg')
//
// headerBG.style.backgroundColor = 'rgb(248 248 248 / 90%)'
// headerBG.style.padding = '20px 40px'
// headerBG.style.paddingBottom = 'padding: 10px 40px 10px 40px'
// headerBG.style.paddingRight = 'padding: 10px 40px 10px 40px'
// headerBG.style.paddingLeft = 'padding: 10px 40px 10px 40px'
})
// Действия при изменении URL
// function changeImgLang(el) {
//
// let img = document.getElementById('dropbtn_lang')
//
// if (el.innerText === 'RU'){
// img.style.background = "url('/static/img/png/ru.png') no-repeat left center;"
// }
// else if(el.innerText === 'EN'){
// img.style.background = "url('/static/img/png/en.png')"
// img.style.backgroundRepeat = "no-repeat"
// img.style.backgroundPosition = "left center"
//
// }
//
// }