修复滚动时的位置元素,并在到达父级的末尾时删除

时间:2016-06-06 20:54:02

标签: javascript jquery html css

我对此question

有类似的问题

这是我追随的jsfiddle

我唯一的问题是粘性元素默认情况下不应该是固定位置,不像jsfiddle上的那个。

#theFixed {
 background-color:red;
 border: solid;
 position:fixed;
 top:250px;
}

我希望达到类似site的效果。因此,当您滚动时,页面的左侧是固定的,当它到达父元素的末尾时,它会返回到它的原始状态。

2 个答案:

答案 0 :(得分:0)

我修改了参考代码,将初始位置设置为position:absolute - 不确定这是否合适。

一旦到达触发点,就会将其设置为固定位置。

当您向后滚动到顶部时,在触发点下方,位置再次设置为"绝对"



var triggerPoint = 250;
var fixeddiv =$("#theFixed");
$(window).scroll(function() {
  var scroll_top = $(this).scrollTop(); // get scroll position top
  if (scroll_top < triggerPoint) {
    fixeddiv.removeClass("fix").removeAttr("style");
    return;
  }
  fixeddiv.addClass("fix");
  var height_element_parent = fixeddiv.parent().outerHeight(); //get high parent element
  var height_element = fixeddiv.height(); //get high of elemeneto
  var position_fixed_max = height_element_parent - height_element; // get the maximum position of the elemen
  var position_fixed = scroll_top < 250 ? 250 - scroll_top : position_fixed_max > scroll_top ? 0 : position_fixed_max - scroll_top;
  fixeddiv.css("top", position_fixed);
});
&#13;
#fixed-parent {
  border: solid;
  position: relative;
}

#theFixed {
  background-color: red;
  border: solid;
  top: 250px;
  position: absolute;
}

#theFixed.fix {
  position: fixed;
}

#footer {
  background: url(http://1.bp.blogspot.com/-tMcpeIB_gNI/T4ma2zDt6yI/AAAAAAAAZro/eWDLUPsVr3Q/s640/Homero-Simpson_The-Simpsons_05.jpg);
  height: 400px;
  width: 500px;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="fixed-parent">
  <div id="theFixed">0 SOMETHING
    <br />1 SOMETHING
    <br />2 SOMETHING
    <br />3 SOMETHING
    <br />4 SOMETHING
    <br />5 SOMETHING
    <br />6 SOMETHING
    <br />7 SOMETHING
    <br />8 SOMETHING
    <br />9 SOMETHING
    <br />10 SOMETHING
    <br />11 SOMETHING
    <br />12 SOMETHING
    <br />13 SOMETHING
    <br />14 SOMETHING
    <br />15 SOMETHING
    <br />16 SOMETHING
    <br />17 SOMETHING
    <br />18 SOMETHING
    <br />19 SOMETHING
    <br />20 SOMETHING
    <br />21 SOMETHING
    <br />22 SOMETHING
    <br />23 SOMETHING
    <br />24 SOMETHING
    <br />25 SOMETHING
    <br />26 SOMETHING
    <br />27 SOMETHING
    <br />28 SOMETHING
    <br />29 SOMETHING
    <br />
  </div>

  THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS
  <BR>THIS IS A LONG SENTENCE THAT GOES PAST THE RED SOMETHINGS</div>
<div id="footer"></div>
&#13;
&#13;
&#13;

如果您准备试用插件,请检查http://leafo.net/sticky-kit/ 这将满足您的要求。

答案 1 :(得分:0)

我认为Scroll Magic会很有用。