-2

I have 5 images placed in a div, the images are color but I want them to all be grayscaled firstly and then the first 3 to slowly fade into color one by one after the page loads. I've tried to achieve this using various jquery scripts like jQuery grayscale, desaturate, etc. to no success. Can someone please figure it out for me?

Script looks like this:

<div class="cupImg">
   <img src="img/cup.png" alt="" /><img src="img/cup.png" alt="" /><img src="img/cup.png" alt="" /><img src="img/cup.png" alt="" /><img src="img/cup.png" class="last" alt="" />
</div>

1 Answers1

1
  1. Set all images to grayscale with .gray class in CSS3

https://stackoverflow.com/a/4028908/2630208

  1. Set transition animation to your elements with CSS3
  2. Use .slice(0,3) jQuery method to select first three elements from your
  3. Remove .gray class with pure jQuery

http://jsfiddle.net/8Q39r/1/

BTW. Code won't work in Presto's based Opera. It's a feature limitation of that browser.

Community
  • 1
  • 1
Kamil Szymański
  • 950
  • 12
  • 26