I have to keep the element in view while scrolling. i have done it and it’s working fine in all the browser, but not wise resolution wise.
$(function() {
var offset = $(".sysIcons").offset();
var topPadding = 15;
$(window).scroll(function() {
if ($(window).scrollTop() > offset.top) {
$(".sysIcons").stop().animate({
marginTop: $(window).scrollTop() - offset.top + topPadding
});
} else {
$(".sysIcons").stop().animate({
marginTop: 0
});
};
});
});
it’s working fine in 1024 x 768, 1280 x 735,
But not in 1360X768, – problem is while scrolling till at the end of the window, it will not stop. continuously animate while scrolling.
please help me out
This might do what you are looking for.
http://imakewebthings.com/waypoints/shortcuts/sticky-elements/
Main site: http://imakewebthings.github.com/jquery-waypoints/
Github: https://github.com/imakewebthings/waypoints