2013-10-01 48 views
3
不起作用

我创建这些覆盖前面和后面的箭头,这样网站上的那些 - http://www.usatoday.com位置固定在Chrome

而且我得到的是Chrome的问题,箭头不会保持不变,当我向下滚动页面时,箭头会随着页面一起上升,而您再也看不到它们了。奇怪的是,他们在Firefox中工作并保持最佳状态:45%的位置:像他们应该一直固定的时间。 这里是它如何工作在FF的截图:https://www.dropbox.com/s/2vsrv874c3urlqs/firefox.PNG

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

的HTML中箭:

<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:

.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); 
} 
+1

此代码在Mac和Windows(http://jsfiddle.net/Lj3RG/)上给出了Chrome中垂直居中的箭头。箭头周围是否包含元素会导致问题,或页面上是否有更改这些样式的任何JavaScript? – cjspurgeon

+0

我发现有3个文件,当我禁用他们的箭头工作,但我需要他们的文章滑块在页面上。 https://www.dropbox.com/s/jtpflj57yxqmed4/dan.css https://www.dropbox.com/s/db2wdzll4p1fmw6/jquery.bxslider.css https://www.dropbox.com/s/i5ceq3yoinxqzct/ jquery.validate.min.js我无法想象会发生什么,只会影响Chrome和Firefox中的箭头,它们完美地工作。 – Lox

+2

我仍然无法重现问题,所以我猜想它是包含元素的样式。无论是箭头的包装,还是内容的包装。我发现了其他关于Chrome位置的报告:固定问题。你可以尝试'-webkit-transform:translateZ(0);'在固定元素上 - http://stackoverflow.com/questions/17068361/chrome-positionfixed-inside-positionabsolute-breaking-with-iframe-video或者可能调查z-index堆栈上下文 - http://stackoverflow.com/questions/12781115/positionfixed-not-working-in-chrome-22? – cjspurgeon

回答

15

我用cjspurg方法和它的工作。再次感谢!

-webkit-backface-visibility: hidden; 
-webkit-transform: translateZ(0); 
+3

这给了你处理固定元素的癌症,这些固定元素放置在要应用的元素内部-webkit-transform:translateZ(0);属性。你会发现修复不再适用于容器元素内的元素。 – manish