所以我正在为一个亲戚做一个网站,我做了一个一开始不显示的网站(display : none),当用户点击页面上的某个地方时,它就会淡出。
它在Chromium上运行得很好,但当我尝试使用Iceweasel 31.2时,页面中应该淡入的部分的CSS无法加载。
单击按钮时调用的javascript函数:
var openGallery = function(){
$('section, nav, #topleft').fadeOut(400);
$('#gallerie').toggle();
}这是涉及到的CSS
#gallerie
{
position: relative;
height: 874px;
width: 1152px;
background-color: rgba(0,0,0,0.2);
border-radius: 5px;
margin: auto;
text-align: center;
}
#gallerie img:first-of-type
{
max-width: 1100px;
max-height: 720px;
display: block;
margin-left: auto;
margin-right: auto;
}
.close
{
display: inline-block;
position: absolute;
right: 5px;
top: 5px;
}
.left, .right
{
position: static;
top: 746px;
}最后,淡入/淡出的HTML (请注意,它的JS部分来自一些PHP)
<div id="gallerie">
<script type="text/javascript">
var collection = [
// "FILENAME" | "NAME" | WIDTH | HEIGHT
["6ème arrondissement-73 X 60.JPG","6ème arrondissement",1535,1832],
(more data...)
["Sur la neige-55 X 46.JPG","Sur la neige",1853,1562]
]
</script>
<h3>Gallerie</h3>
<figure>
<img src="data/tableaux/6ème arrondissement-73 X 60.JPG" class="big" title="6ème arrondissement" alt="0">
<figcaption>6ème arrondissement</figcaption>
<img src="images/left.png" alt="left" class="left" title="left"><img src="images/right.png" alt="right" class="right" title="right">
</figure>
<img src="images/close.png" class="close" title="Fermer la fenetre">
</div>我真的不知道bug是从哪里来的。谢谢你帮我的忙。
发布于 2014-11-11 01:06:51
就我个人而言,我会使用JQuery在类事件之间切换,并使用这些事件进行转换等。目前,CSS3在各种浏览器上都很好用。
而不是:
$('section, nav, #topleft').fadeOut(400);我会添加处理淡入淡出和过渡的CSS。
看看我在这里制作的钢笔,看看效果。您可以选择添加toggleClass();、addClass();或removeClass();。
http://codepen.io/brycesnyder/pen/LEPJZg
编辑:.toggle();会导致愚蠢的效果,我指的是.toggleClass();
https://stackoverflow.com/questions/26848846
复制相似问题