I have 2 jQuery files. In first, I have a variable definition. In second I want to load it.
#File 1:
$(document).ready(function(){
//some jquery codes:
windowWidth = $(window).width();
windowHeight = $(window).height();
//my variable:
let myElements = [
{ top: windowHeight-100, left:windowWidth-100 }
...
];
});
#File 2:
$(document).ready(function(){
...
// I need "myElements" variable from #File1 here!
...
});
HTML:
<head>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/file-1.js" type="text/javascript"></script>
<script src="js/file-2.js" type="text/javascript"></script>
</head>
How I can load variable or functions from another jQuery file in my jQuery file?
I need "myElements" variable from #File1 in #File2.