Arjan10
Arjan10

Reputation: 13

Transition not working in FireFox

I made this hover effect on an image and it works and all. Except for FireFox. The pink background works, but the square doesn't have the transitions. I tried using -moz-transform, didn't work. I tried changing 'all' to transform, still didn't work.

Can someone help me?

Here is the fiddle:

HTML:

    <div id="img">
        <div id="overlay">
            <div class="expand">
        </div>
    </div>
</div>

CSS:

#img {
    height: 150px;
    width: 350px;
    background: url('http://placehold.it/350x150');
}

#img #overlay {
    background: rgba(229, 66, 147, 0);
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
    height: 150px;
    width: 350px;
}

#img #overlay:hover {
    display: block;
    position: absolute;
    background: rgba(229, 66, 147, 0.6);
    z-index: 20;
    overflow: hidden;
    height: 150px;
    width: 350px;
}
.expand {
    display: inline-block;
    margin: auto;
    margin-left: 39%;
    margin-top: 12%;
    z-index: 100;
    width: 60px;
    height: 60px;
    border: solid 5px #fff;
    color: #fff;
    line-height: 50px;
    font-weight: 700;
    font-size: 30px;
    transform: scale(0);
    opacity: 0;
    -webkit-transition: all 0.5s;
    -moz-transition: all 0.5s;
    -o-transition: all 0.5s;
    transition: all 0.5s;
}

#img #overlay:hover .expand {
    transform: scale(1);
    opacity: 1;
}

http://jsfiddle.net/9qeywb75/

Upvotes: 1

Views: 88

Answers (1)

norin89
norin89

Reputation: 482

There's a bug in Firefox - Bug 625289. It seems that transitions in FF doesn't work when you change element needs to be reconstructed - e.g. it's position is changed.

To fix that simply move position: absolute; and overflow: hidden; from #img #overlay:hover to #img #overlay and it's gonna work in FF!

Upvotes: 1

Related Questions