简体   繁体   中英

CSS div fixed positioning

I have a div that contains a smaller div with some text. The container div has a webkit transition that moves it off the screen. I want the smaller div to move with it, until it gets to the edge of the page, then remain fixed, almost as if it gets 'stuck' on the side of the page, while the container div continues to move underneath it out of sight. Can this be done?

//CSS
.move{
    -webkit-transition-property:left;
    -webkit-transition-timing-function:ease-in-out;
    -webkit-transition-duration:1s;
    left:-200px;
}

//HTML
<div onclick="this.className='move'">
     <div>
         some text here
     </div>
</div>

Here's an example for you: http://jsfiddle.net/LjjRM/

A couple points:

1.) jQuery

2.) position: absolute

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM