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.

4

2 に答える 2

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;
}
}
于 2012-07-17T10:37:18.243 に答える
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;
}

}

于 2012-07-17T12:47:10.310 に答える