I'm relatively new to Jquery and its working and am sure that my syntax is wrong somehow I am just not sure how to fix it.
Basically I need to get the (window).height and (window).width of a screen, and then take these values and divide them by 1920 and 1080, respectively, for my website code.
Here is the jquery I have written:
$(document).ready(function () {
var resx = $(window).width();
var resy = $(window).height();
var disx = (resx)/1920;
var disy = (resy)/1080;
});
I then want to use 'disx' and 'disy' in my HTML document for a data-x and data-y value.. I think this is where my problem lies -- How exactly do I get the data-x value to be equal to disx * (whatever pixel value I need)?
<div id="video-step" class="step" data-x="<script type='text/javascript'>document.write(($disx)*(-1920))</script>"
data-y="0">
</div>
^ That is how I currently am trying, to no avail..
Can anyone inform me of how exactly to put the variable into my html? Or if my variable format is even correct?
Thank you!