I am making a website for my Boy Scout Troop, and it is employing a responsive design to make navigation simpler on small screens. It works perfectly when resizing a desktop browser, as well as on device emulators (I have tried it on several, and for a variety of devices), but it is not reactive on actual devices, including IPhones, IPods, and Androids, using either default, or 3rd party browsers. I can not figure out any reasons why this would happen. The only differences I know of between a device and an emulator is the User Agent string, which I use to handle IE separately (I am still debugging the reactive design for IE, and am having issues, but that is a seperate topic), but should not effect anything else excpet possibly on a Windows phone.
The URL for the website is: http://bsatroop159.org
Note: You may notice several small errors such as a page being pushed toward one side, or an image leaving it's bounds, but I have actually fixed those, I just need to send in the patch still.
The opening line of the CSS for my media queries looks like:
@media handheld, only screen and (max-width: 725px)
A possibly relevant segment of my JavaScript:
function isIE(){
var ua = window.navigator.userAgent;
var older_ie_ua = ua.indexOf('MSIE ');
var newer_ie_ua = ua.indexOf('Trident/');
if ((older_ie_ua > -1) || (newer_ie_ua > -1)) {
return true;
}
return false;
}
function setViewingMode()
{
//Screen Sizes
var width = document.documentElement.clientWidth;
var WinHeight = document.documentElement.clientHeight;
//Make sure this matches the media queries in the CSS files CSS_Reactive_Designing and CSS_SimpleGrid
var minWidth = 725;
//&& navigator.appName != 'Microsoft Internet Explorer' needed while mobile mode not working in IE
if(width <= minWidth && isIE() != true) {//This Qualifies for special mobile site mode
DesktopNavigator = document.getElementById('non_mobile_only_element');
DesktopNavigator.style.display="none";
MobileNavigator = document.getElementById('mobile_only_element');
MobileNavigator.style.visibility="visible";
MobileNavigator.style.display = "block";
var dsoctop=document.all? iebody.scrollTop : pageYOffset;
makeTall = document.getElementById('mp-menu');
makeTall.style.height= (WinHeight)+"px";
makeTall.style.top= (dsoctop)+"px";
pusher = document.getElementById('mp-pusher');
pusher.style.paddingLeft="0px";
}
else{//This uses the standard website mode
DesktopNavigator = document.getElementById('non_mobile_only_element');
DesktopNavigator.style.display="block";
MobileNavigator = document.getElementById('mobile_only_element');
MobileNavigator.style.visibility = "hidden";
MobileNavigator.style.display="none";
pusher = document.getElementById('mp-pusher');
pusher.style.paddingLeft="0px";
}
}
setViewingMode();
</script>
I can add more code to the question if someone hints at anything else that may be relevant, or I can remove some if what I have is just cluttering the page. I would really appreciate any help with this, as this is a pretty major issue, and I spent a long time making it reactive. I tried everything I could think of to fix it, but honestly, I could not think of much (not sure what could be the culprit). Thanks ahead of time for any help.
Aucun commentaire:
Enregistrer un commentaire