So, I have a single page that has a lot of content and animation that I set up to run in only one html file. It is a exposition of museum online.
But I want to call (and generate) a specific url for some steps of this page. For example, there’s a place called ARQUIVO (Archive) that I want to give the url for user:
https://indisciplinar.com.br/?arquivo
And for that, it should call a global function that goes for a step in animation that it’s already set as callArquivo().
This callArquivo() is defined in functions.js and it is already called in html.
After all this calls, I have a script tag:
const loader = document.getElementById('preloader')
window.addEventListener('load', onload)
function onload(){
document.getElementById('buttonStart').style.display = 'block'
document.getElementById('loadingText').style.display = 'none'
}
function start(){
console.log('started')
callArquivo()
loader.style.display="none"
returnScroll()
setTimeout(goScroll(50),1000)
}
if(window.location.search.split('?')[1] == 'arquivo'){
start()
} else { console.log('notArquivo') }
When I call in address bar https://indisciplinar.com.br/?arquivo,
I got in console
the first step of console.log(‘started’), but it stucks in second step callArquivo().
The response is that “callArquivo() is not defined at start (?arquivo:1184:13)”
I don’t know if it is something to do with github pages, I think it’s not, because, it won’t work locally neither.
ChatGPT suggested me some stuff like add “index.html” before in url as: https://indisciplinar.com.br/index.html?arquivo
But it’s still not working. I got the same response of Uncaught ReferenceError.
I don’t know what exactly should I do or even what to study or search to solve this issue.
Could I have some answer?
Sorry my English. I’m not good speaker.
I just want to have an option to have custom url parameters to call functions that they were set up in functions.js file.