So i have the following script that basically adjust the position of an element on the screen.
it works perfectly on the other browsers but cause an error on IE8
Here is the whole function call that causes the problem
function ajax_load(){
var screenwidth = window.innerWidth
var screenheight = window.innerHeight;
var current_width = 250;
var current_height = 70;
var left = (screenwidth - current_width)/2;
var bottom = (screenheight - current_height)/2;
var secondajaxloaderElement = document.getElementById('ajax_loader');
secondajaxloaderElement.style.bottom = bottom + 'px'; // Line 308 - problematic line
secondajaxloaderElement.style.left = left + 'px';
}
Any idea why would this fail on IE ?
The error i get from developer tool is :
Invalid argument. and a line number(308) which point to
secondajaxloaderElement.style.bottom = bottom + 'px';
Thoses are not supported in IE8:
http://www.w3schools.com/jsref/prop_win_innerheight.asp
See this post :
window.innerHeight ie8 alternative
This should work in IE8:
Or you could also use jQuery with :