开发者

float div on page below an accordian

From the image below you can see that I have a "Quick Tips" div. For examples sake lets say that the outermost div is called: id = "TipsDiv" You can see that it is below the accordion. I want it to stay below the accordion. H开发者_运维百科owever when the user scrolls down the div should never go above (0,0). And when the user scrolls back up it should be like it is in the picture.

float div on page below an accordian

If i didn't make my self clear please let me know and i'll try to explain better.

Thanks!


You should be able to use something like this example I created for another question, with some modification to handle the accordion. Basically you will need to replace the 250 with the calculated height of the accordion.

http://jsfiddle.net/b43hj/

$(window).scroll(function(){
    $("#theFixed").css("top",Math.max(0,250-$(this).scrollTop()));
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜