javascript - How to keep an element fixed top within another element? -


here jsfiddle , html:

<div class="wrapper">     <div class="blur"></div>     <div class="content">         text<br>         text<br>         text<br>         text<br>         text<br>         text<br>         text<br>         text<br>         text<br>     </div> </div> 

and css:

.wrapper{     position: relative;     width: 300px;     height: 100px;     margin: 100px auto;     background-color: #c0c0c0;     overflow-x: hidden;     overflow-y: auto; }  .blur{     width: 400px;     height: 50px;     position: absolute;     background-color: #000000;     -webkit-filter: blur(10px);     -ms-filter: blur(10px);     -o-filter: blur(10px);     -moz-filter: blur(10px);     filter: blur(10px);     left: -50px;     top: -20px; } 

how keep .blur element fixed top within .wrapper element when scroll .content element? think jquery scrolltop might solution. tell me how this?

well, if position of "content" set , same wrap blur in fixed container this:

.container-blur {     position:fixed;     width:282px;     top:100px;     overflow:hidden;     height:50px; } 

fiddle


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -