预滚动CSS与后滚动不同

时间:2012-06-19 21:44:55

标签: javascript jquery html css

滑动工作小提琴但滚动前宽度不正确here。正确的布局,但没有滚动功能here。还在学习CSS,但出于某种原因,如果我删除了以下固定的浮动端CSS:

#commentWrapper { 
  position: absolute;
  margin-left: 35px;
  left: 450px;
  width: 280px;
}

#comment {
  position: absolute;
  top: 0;
  /* Can include margins in the sliding effect here */
}

#comment.fixed {
  position: fixed;
  top: 0;
}

,侧面的位置是正确的,但是当您向下滚动时它不会停留在固定位置。保持代码,CSS由于某种原因减少了边的宽度,但是一旦向下滚动,它就变得正常了。如何修复它以使其在正确位置和宽度的一侧加载?

1 个答案:

答案 0 :(得分:1)

我更新了你的CSS。 Take a look。我希望这能解决你的问题!

我改变了相关代码:

新:

#commentWrapper { 
float:right;
margin-left: 10px;
margin-right: 10px;
left: 450px;
width: 25%;
}

旧:

#commentWrapper { 
    position: absolute;
    margin-left: 35px;
    left: 450px;
    width: 280px;
}