Is it possible to simplify it somehow:
function is_iOS() { var iDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod']; while (iDevices.length) { if (navigator.platform === iDevices.pop()) return true; } return false; } function fixedRec(el) { if($(document).scrollTop() >= el.prev().offset().top + el.prev().outerHeight()) { if($(document).scrollTop() < el.parent().outerHeight() - ($(window).outerHeight() / 1.5)) { if(is_iOS() || $(window).width() < 1000){ el.removeClass('fixed').addClass('absolute').css({top: (top - 150)}); } else { el.removeAttr('style').removeClass('absolute').addClass('fixed'); } } else { el.removeAttr('style').removeClass('fixed').addClass('absolute'); } } else { el.removeAttr('style').removeClass('absolute').removeClass('fixed'); } }