0

所以我正在为一个亲戚制作一个网站,我制作了一个最初不显示的网站(显示:无),当用户单击页面上的某个位置时会淡入。
它在 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>

我真的不知道错误可能来自哪里。谢谢你的协助。

4

1 回答 1

0

Personally, I would use JQuery to toggle through the class events and use those to do the transitions etc. Right now, CSS3 is pretty good across browsers.

Instead of:

$('section, nav, #topleft').fadeOut(400);

I would add CSS that handles the fade with a transition.

Check out the pen I made here to see the effect. You can add toggleClass(); addClass(); or removeClass(); should you choose.

http://codepen.io/brycesnyder/pen/LEPJZg

EDIT: .toggle(); will cause a stupid effect, I meant .toggleClass();

于 2014-11-10T17:06:50.897 回答