My goal is to position an image in the center of the screen by performing some calculations. I've tried using:
var wh = jQuery(window).innerHeight();
var ww = jQuery(window).innerWidth();
var fh = jQuery('.drop').innerHeight();
var fw = jQuery('.drop').innerWidth();
However, I can't seem to figure out where I went wrong. I also attempted to adjust for window resizing with:
jQuery(window).resize(function() {
var wh = jQuery(window).innerHeight();
var ww = jQuery(window).innerWidth();
var fh = jQuery('.drop').innerHeight();
var fw = jQuery('.drop').innerWidth();
});
Even after resizing the window, the image still doesn't align to the center as intended. Is there a method to ensure that the image remains centered even when the window size changes?
You can view the code on JSFiddle.