How do i randomly swap out the contents of a div
so i'm building a mobile safari iPad app using jquerymobile...
I was using this link as a tutorial... http://www.impressivewebs.com/css3-transitions-javascript/
.galleryContainer {
position: fixed;
-webkit-transition: -webkit-transform 0.25s ease-in-out;
-webkit-transform:translate3d(0px,0px,0px);
}
.galleryContainer-A{
-webkit-transform:translate3d(100px,0px,0px);
}
.galleryContainer-B{
-webkit-transform:translate开发者_Go百科3d(200px,0px,0px);
}
.galleryContainer-C{
-webkit-transform:translate3d(300px,0px,0px);
}
.galleryContainer-D{
-webkit-transform:translate3d(800px,0px,0px);
}
So I can toggle between the original class and galleryContainer-A by doing this...
$(".galleryContainer").toggleClass("galleryContainer-A");
I want the class to change without having to go back to the original position, how do I go about doing that?
Ideally you shouldn't. The question that comes up in my mind is what is it about the -A class that you want when you toggle it to that class? If it's a particular style attribute, you should use another class and toggle that. If it's the benefit of using that selector, again use a different class and go off of that. The transition is irrevocably tied to that -A class, so if you don't want that transition don't use that class. Use another separate class in addition to it.
精彩评论