How to create a variable that is defined when page is loaded and not in script?
<script>
var comp = 0;
function mMove(e)
{
var x = e.screenX;
if (x > comp + 80)
{
comp = x;
somethingcool();
}
}
</script>
<video id="vid_ID" onclick="vidclick()" onmousemove="mMove(event)" controls tabindex="0" autobuffer preload>
<source type="video/mp4; codecs="avc1.42E01E, mp4a.40.2"" src="test.mp4"></source>
<p>Sorry, your browser does not support the <video> element.</p>
</video>
I have some video and onmousemove event. I want to run the somethingcool() function every time my mouse moves along the x-axis by 80 pixels. I need some way to store comp variable.