禁用固定按钮位置

时间:2012-08-30 01:25:29

标签: css css3

我正在编辑一个带有社交媒体按钮的设计,当您向上和向下滚动页面时,它会跟随您。我希望这种行为能够停止,这样只有当你处于最顶层时才能看到它们。我认为这是相关的代码(不是100%肯定):

.rt-social-buttons .rt-social-icon {
   height: 43px;
   width: 43px;
   float: right;
   display: block;
   background-repeat: no-repeat;
   margin-bottom: 2px;
   -webkit-transition: width 0.2s ease-in, background-color 0.2s ease-in;
   -moz-transition: width 0.2s ease-in, background-color 0.2s ease-in;
   -o-transition: width 0.2s ease-in, background-color 0.2s ease-in;
   -ms-transition: width 0.2s ease-in, background-color 0.2s ease-in;
   transition: width 0.2s ease-in, background-color 0.2s ease-in;
 }

.rt-social-buttons .rt-social-icon:hover {
   width: 150px;
 }

该网站为here

我需要从上面的代码中删除什么才能停止按钮移动?

1 个答案:

答案 0 :(得分:0)

滚动时按钮卡在页面上的原因是position: fixed div上的.rt-social-buttons

这就是我在右边做的静态做法:

1。)div .rt-social-buttons获取position:absolute而不是position:fixed

2。)div .rt-social-buttons被拉入体内(.container div相对定位,所以绝对将.rt-social-buttons div放在里面不会让它被定位在同一个地方。