How to position a fixed element

> **Possible Duplicate:** > [Stopping fixed position scrolling at a certain point?](https://stackoverflow.com/questions/5902822/stopping-fixed-position-scrolling-at-a-certain-point) After I scroll past a certain point I need an element (side bar of links) to not scroll anymore, but yet just stay where it is. I have tried setting this element to fixed after the certain point and this works fine other than it snaps the side bar links down into view in the window in the same position they were before i started scrolling and then fixes them to the window where they do not scroll anymore. I would like to not see this instead once i scroll past the certain point just leave the element where it is on the page, but do not allow it to be scrolled anymore (therefore my side bar of links will be slightly scrolled up off the page, but the bottom links still showing) . triggering the event of setting the element to fixed or not fixed is not my problem that works fine. I just need to position the element AFTER setting it to fixed so that i can put it back up where it started, or find and alternate to setting the position to fixed after I scroll past this certain point. again desired behavior is that once i scroll down so far on my page, my side bar of links just stay where they are (partly scrolled down, which means the top part is off the page) and then as i continue to scroll down they do not move. most likely i am thinking i need to reposition the links after the position is being changed to fixed. ANY HELP? THANKS!
no, i can scroll to where i set it to fixed and set it to fixed, then i can scroll up and set it back from not being fixed. that is not my problem. triggering the event at the right place and "fixing" the element i can do. the behavior i am getting from setting the element to fixed is what i have a question about, if i can handle the behavior or use something else besides setting position fixed. I was the element to stop scrolling, but still stay where it was after i scrolled past the point where i change the element to fixed. once i hit that point the element is jumped down then becomes fixed

以上就是How to position a fixed element的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏