2013-12-17 46 views
1

我的网站: http://www.lotusroomofboca.com/menu.html问题与字幕在画廊图像

我终于拿到了鼠标悬停工作,以显示下面的绿色,但是文本字幕,我把在图像显示笨拙悬停。我希望他们出现绿色的淡入淡出。另外,如果你将鼠标悬停在字幕淡入淡出不起作用..

@Trevor这里是所有这个画廊的CSS:

.floated_img {float:left; 
       width:210px; 
        height:144px; 
        margin-right:15px; 
        margin-bottom:15px; 
        background-color:#7b8c6f; 
        text-align:center; 
       } 

.floated_img img {width:210px; 
        height:144px; 
        margin-right:15px; 
        margin-bottom:15px; 
        background-color:#7b8c6f; 
        position:absolute 
        } 

.floated_img img:hover {-moz-opacity:0.15; 
         -khtml-opacity: 0.15; 
         opacity: 0.15; 
         transition-duration:0.5s;} 

.caption p { 
    font-family: 'Avenir'; 
    font-size: 15px; 

} 


.caption { 
    z-index: 1000; 
    color: white; 
    text-align: center; 
    position: absolute; 
    top: 25%; 
    margin: auto; 
    display: none; 
    pointer-events: none; 
}   

.floated_img:hover .caption {z-index:10000; 
      color:white; 
      text-align:center; 
      position:relative; 
      margin:auto; 
      display:block;} 
+0

什么代码正在做mouseover淡出到绿色?你可以分享你使用的JavaScript或CSS来实现吗? – Trevor

+0

你可以检查我的更新,并尝试使用'transition:opacity .5s ease-out; -webkit-transition:不透明.5s缓解;'看看它是否能为你解决它。你使用的是什么浏览器? – Trevor

+0

我试过你的更新,它仍然会。我正在使用Chrome。 – Marissa

回答

1

尝试:

.caption p { 
    font-family: 'Avenir'; 
    font-size: 15px; 
    opacity: .6; // makes a little of the green color go through 
} 


.caption { 
    z-index: 1000; 
    color: white; 
    text-align: center; 
    position: absolute; 
    top: 25%; 
    margin: auto; 
    display: none; 
    pointer-events: none; // new makes it so the caption does not interfere with hover 
} 

更新2尝试:

.caption { 
    z-index: 1000; 
    color: white; 
    text-align: center; 
    position: relative; //new 
    top: 25%; 
    margin: auto; 
    pointer-events: none; 
    display: block; 
    opacity: 0; 
    transition: opacity .5s; 
    -webkit-transition: opacity .5s; 
}   

.floated_img:hover > .caption {z-index:10000; 
      color:white; 
      text-align:center; 
      position:relative; 
      margin:auto; 
      opacity: 1; 
} 
+0

这工作完美,谢谢!任何方式使字幕变白?他们有点被这个代码淘汰了。 – Marissa

+0

@Marissa哦,然后删除'opacity'行。我试图理解你使用字幕时遇到的问题。那就是他们显示速度太快了? – Trevor

+0

好多了,谢谢。是的,他们显示得太快了。最大的问题是固定的指针事件。 – Marissa