In my app I use this code to center a div with content vertically:
//contdiv is a div with the size of mobilecontent.
$(window).load(function (){
var contdiv = $('.contdiv');
var contdivHeight = +$(contdiv).height();
var contdivHeight2 = contdivHeight / 2;
var contdivHeight3 = contdivHeight2 - contdivHeight;
//contentdiv is the div with content that should be centered on page.
Appery('contentdiv').css('position', 'absolute');
Appery('contentdiv').css('top', '50%');
Appery('contentdiv').css('margin-top', contdivHeight3);
});
It works as expected in all web browsers and mobile browsers but the code does nothing in appery.io tester on mobile or in Xcode simulator.
I have tried running code on pageshow event etc but only the above solution gets the right height and centers properly.
Why is this and how can I achieve this result not only in browsers, but in real app?
Thanks, V