sczdavos
sczdavos

Reputation: 2063

Transition delay CSS3

I have some slider with images.

If I will put mouse on some slide it will just show the image and the image should be without grayscale efect. But I want to have transition delay for changing this efect.

How can I specify that on hover on the li element in which is the image will change the image inside using transition delay:

.grayscale
{
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 3.5+ */
    filter: gray; /* IE6-9 */
    -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */
    -webkit-transition: all .6s ease; /* Fade to color for Chrome and Safari */
    -webkit-backface-visibility: hidden; /* Fix for transition flickering */
}


.grayscale:hover
{
    filter: none;
    -webkit-filter: grayscale(0%);
}



<li class="kwick grayscale"><!-- using it here will slow down slide effect -->
<a href="' . $article['url'] . '">
    <div class="kw_shadow"></div>
    <div class="kw_title">' . $article['title'] . '</div>
    <div class="kw_img">
    <img src="' . $article['imageSrc'] . '" alt="' . $article['title'] . '" style="width: 960px; height: 400px;" class="grayscale" /><!-- using it here will apply grayscale if I'm with my mouse fxp on the bottom on right side -->
    </div>
</a>
</li>

Here it is live: http://www.sczdavos.eu/

Thanks for ideas.

Upvotes: 0

Views: 2492

Answers (2)

Rajender Joshi
Rajender Joshi

Reputation: 4205

Make sure to put -webkit-transition-delay at the end. Otherwise, it won't work.

This works

.kwick a:hover img.grayscale{
    -webkit-filter: grayscale(0%);
    -webkit-transition: all .6s ease;
    -webkit-transition-delay:2s;
}

This doesn't

.kwick a:hover img.grayscale{
    -webkit-filter: grayscale(0%);
    -webkit-transition-delay:2s;
    -webkit-transition: all .6s ease;
}

Upvotes: 2

sinhayash
sinhayash

Reputation: 2803

May be -webkit-transition-delay property can be helpful for you,

try this:

.grayscale img {
    transition-delay: 2s;
    -webkit-transition-delay: 2s;
}

Upvotes: 0

Related Questions