After not finding exactly what I needed, I decided to gather inspiration from various sources online and piece together a solution. Hopefully, this method will prove helpful to others as well.
function getiOSVersion() {
if(navigator.userAgent.match(/ipad|iphone|ipod/i)){ //checks if the user is using an Apple device
var iosInfo ={};
iosInfo.UserAgent=navigator.userAgent;
iosInfo.AsReported=(navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0];
iosInfo.MajorRelease=(navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].split('_')[0];
iosInfo.FullRelease=(navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].replace(/_/g,".");
iosInfo.MajorReleaseNumeric=+(navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].split('_')[0].replace("OS ","");
iosInfo.FullReleaseNumeric=+(navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].replace("_",".").replace("_","").replace("OS ","");
return(iosInfo);
}
}
This function retrieves both the major release and full release numbers for iOS, allowing them to be returned either as strings or numbers.
Example User Agent String:
var iOS=getiOSVersion();
console.log(iOS.FullRelease); //returns "OS 6.1.3"
console.log(iOS.FullReleaseNumeric); //returns 6.13
console.log(iOS.MajorRelease); //returns "OS 6"
console.log(iOS.MajorReleaseNumeric); //returns 6
console.log(iOS.AsReported); //returns "OS 6_1_3"
console.log(iOS.UserAgent); //returns full user agent string
In the context of the question that was asked originally, this code could be implemented in the following way:
var iOS=getiOSVersion();
$(document).bind("scroll", function() {
if(iOS){if(iOS.MajorReleaseNumeric < 5) {}
else {changeFooterPosition();}
}
});