1

what I mean in the title is, no matter which container is on top (is visible) in the fade-style animation, the href in the "onclick" is always the same.

here is the html

<div id="teaserslider">
                <ul>
                    <li>
                        <section id="container_1">
                            <div class="head gradient-top loading" onclick="document.location.href='container1_detail.html'">
                                <div>
                                  <!-- Content -->
                                </div>
                            </div>

                        </section>
                    </li>
                    <li class="animation">
                        <section id="container_2">
                            <div class="head gradient-top loading" onclick="document.location.href='container2_detail.html'">
                                <div>
                                  <!-- Content -->
                                </div>
                            </div>

                        </section>
                    </li>
                </ul>
            </div>

here is the css

#teaserslider{
   height: 100px;
   margin-bottom: 6px;
}

#teaserslider li {

   position: absolute;

   list-style: none;
   -webkit-transition: opacity 1s ease-in-out; 
}

@-webkit-keyframes fadeout{

0% {
    opacity:1;
}
45% {
    opacity:1;
}
55% {
    opacity:0;
}
100% {
    opacity:0;
}
}

#teaserslider li.animation {
   -webkit-animation-name: fadeout;
   -webkit-animation-timing-function: ease-in-out;
   -webkit-animation-iteration-count: infinite;
   -webkit-animation-duration: 5s;
   -webkit-animation-direction: alternate;
   -webkit-transform: translateZ(0);//hardware acceleration

}

you may have noticed, I only use the webkit engine because this code runs inside a Phonegap Application for iOS. No matter which container is showed currently, when I click the container I always get to "container2_detail.html". Anyone know how to solve this? thanks.

最白目
  • 3,505
  • 6
  • 59
  • 114
  • After a quick test - this seems to be because the html markup order means that container_2 is always going to be *on top* of container_1, even if it's faded out... plus, this answer might help: http://stackoverflow.com/questions/3331353/css-3-transitions-on-the-display-property – Dave Everitt Jul 17 '12 at 10:46
  • hmm sorry not atm. I tryed jsFiddle but it doesn´t show a result – 最白目 Jul 17 '12 at 10:49

2 Answers2

1

May be you have to define z-index to it. Write like this:

@-webkit-keyframes fadeout{

0% {
    opacity:1;
    z-index:1;
}
45% {
    opacity:1;
    z-index:1;
}
55% {
    opacity:0;
    z-index:-1;
}
100% {
    opacity:0;
    z-index:-1;
}
}
sandeep
  • 91,313
  • 23
  • 137
  • 155
0

I tried this and it seems to work

@-webkit-keyframes fadeout{

0% {
    opacity:1;
    z-index: 1;
    display: block;
}
45% {
    z-index: 1;
    display: block;
    opacity:1;
}
55% {
    z-index: -1;
    display: none;
    opacity:0;
}
100% {
    z-index: -1;
    display: none;
    opacity:0;
}

}

最白目
  • 3,505
  • 6
  • 59
  • 114