Created
May 18, 2012 11:26
-
-
Save adjohu/2724771 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
(function() { | |
var iphone = false; | |
var supportsFixed = function () { | |
var ua = navigator.userAgent; | |
if (/iphone|ipod|ipad/i.test(ua)) { | |
iphone = true; | |
return !(/OS [1-4]/i.test(ua)); | |
} | |
if (/android/i.test(ua)) { | |
var version = parseFloat(ua.match(/Android (\d).*/i)[1], 10); | |
return !(version < 3); | |
} | |
return true; | |
} | |
var fixSliderPosition = function() { | |
var slider = $("#qContent"); | |
if (!slider.length) { | |
setTimeout(fixSliderPosition, 200); | |
return; | |
} | |
slider.show(); | |
slider.height(110); | |
setInterval(function() { | |
var top = ($(window).scrollTop() + $(window).height()) - slider.height(); | |
if (iphone) top += 40; | |
slider.css("top", top); | |
}, 10); | |
} | |
if (!supportsFixed()) { | |
fixSliderPosition(); | |
} | |
})(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment