html - JQuery floating div stop after scrolling down certain div -
html - JQuery floating div stop after scrolling down certain div -
please check link
http://jsfiddle.net/sasindu555/xaytt/
i want stop floating special_features
div after scrolling downwards stop
div. how that. please help me. thanks.
try below code - wroks expected http://jsfiddle.net/sasindu555/xaytt/
var name = "#special_features"; var menuyloc = null; $(document).ready(function(){ $(name).css("top", $("#start").offset().top - 10); menuyloc = parseint($(name).css("top").substring(0,$(name).css("top").indexof("px"))) $(window).scroll(function () { var offset = menuyloc+$(document).scrolltop(); if(offset > $("#stop").offset().top){ offset = $("#stop").offset().top - 10; } else if(offset < $("#start").offset().top){ offset = $("#start").offset().top - 10; } offset = offset+"px"; $(name).animate({top:offset},{duration:500,queue:false}); }); });
jquery html scroll overlay
Comments
Post a Comment