开发者

CSS div fixed positioning

开发者 https://www.devze.com 2023-03-19 08:09 出处:网络
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 th

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>
<开发者_如何学Python/div>


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

A couple points:

1.) jQuery

2.) position: absolute

0

精彩评论

暂无评论...
验证码 换一张
取 消