首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >固定位置在Chrome中不起作用

固定位置在Chrome中不起作用
EN

Stack Overflow用户
提问于 2013-10-01 21:39:53
回答 2查看 15.9K关注 0票数 3

我正在创建这些覆盖的上一个和下一个箭头,就像这个网站上的- http://www.usatoday.com

我得到的问题是在Chrome中,箭头不会保持固定,当我向下滚动页面时,箭头会随着页面向上移动,你再也看不到它们了。奇怪的是,在Firefox中,它们工作并保持在顶部: 45%的位置:固定了所有时间,就像他们应该的那样。下面是它在ff:https://www.dropbox.com/s/2vsrv874c3urlqs/firefox.PNG中如何工作的屏幕截图

这是chrome:https://www.dropbox.com/s/zgr2zhkcnohykgj/chrome.PNG

箭头的html:

代码语言:javascript
复制
 <div class="overlay-arrows">
        <div class="front-arrow-wrapper">
            <a href="#" rel="prev" class="prev-link">
                <div class="prev-icon">
                </div>
                <div class="prev-overlay">
                    <span class="categ-next">Category for prev</span>
                    <p>Title of the post for prev</p>
                </div>          
            </a>
            <a href="#" rel="next" class="next-link" >
                <div class="next-icon">
                </div>
                <div class="next-overlay">
                    <span class="categ-next">Category for next</span>
                    <p>Title of the post for next</p>
                </div>              
            </a>
        </div> <!--end .front-arrow-wrapper -->
    </div> <!--end overlay-arrows -->

和CSS:

代码语言:javascript
复制
.overlay-arrows{
    position: fixed;
    top: 45%;
    left: 0;
    width: 100%;
    z-index: 9999;
    overflow: visible;
}
.front-arrow-wrapper{
width: 1104px;
position: relative;
margin: 0 auto;
}
.prev-link{
left: 0;
float: left;
text-decoration: none;
}
.next-link{
right: 0;
float: right;
text-decoration: none;
}   
.prev-icon{
  background: url(../img/prev.png) 100% 0 no-repeat;
  height: 77px;
  width: 45px;
float: left;
}
.next-icon{
  background: url(../img/next.png) 100% 0 no-repeat;
  height: 77px;
float: right;
  width: 45px;
}
.next-overlay, .prev-overlay{
opacity: 0;
filter: alpha(opacity=0);
width: 250px;
width: 250px;
height: 77px;
color: #F16C14;
background: rgba(0, 0, 0, 0.7);
font-size: 14px;
font-family: Helvetica, Arial, "Lucida Grande", sans-serif;
}   
.next-link:hover>.next-icon{
-webkit-transition: all 0.2s ease-out;
  -moz-transition: all 0.2s ease-out;
  -o-transition: all 0.2s ease-out;
  transition: all 0.2s ease-out;
  background: url(../img/next-hover.png) 100% 0 no-repeat;
}
.next-link:hover>.next-overlay{
  -webkit-transition: all 0.2s ease-out;
  -moz-transition: all 0.2s ease-out;
  -o-transition: all 0.2s ease-out;
  transition: all 0.2s ease-out;
  opacity: 10;
  filter: alpha(opacity=100);
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-10-04 20:29:35

我使用了cjspurg方法,它起作用了。再次感谢!

代码语言:javascript
复制
-webkit-backface-visibility: hidden; 
-webkit-transform: translateZ(0);
票数 15
EN

Stack Overflow用户

发布于 2013-10-02 02:01:23

根据这篇文章,你不能在背景图像上使用Z- http://css-tricks.com/forums/topic/fixed-position-z-index-does-not-work-in-chrome/,这可能是问题的一部分。在这篇文章中有一个例子可能会对你有所帮助,它也在这里:http://codepen.io/anon/pen/iKljy (你必须注册一个帐户才能看到它,但它看起来可以帮助你)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19117737

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档