First fix your other issues.
Inside separate js file: BrowserName
is not defined. Is it supposed to be a var or function? It you want to check the browser you can use navigator.userAgent
and test for certain strings. Search this site for more info.
Scroll function: be careful with using function names. They may be reserved words. scroll is a word used by windows and by jquery.
Your onwheel and onkeydown seem to pass only 1 parameter into your function, so that’s why your 2nd param is undefined. Why not do something like:
document.onwheel=doScroll;
document.onkeydown=doScroll;
function doScroll(e){
// e will contain the event
if (e.keyCode == 38 || e.deltaY < 0 ) console.log("Up!");
}
After you fix these you handle other issues… maybe create a new post for it.
solved Loop and animate a div