简体   繁体   中英

fixed div with content inside scrolling

im loosing my mind here...

im trying to make the following: a fixed div always stays appearing in the page, nothing dificult here, but inside this div i need to put some content that will be scrolling along with the rest of the site, note that the content has NOT his own scrollbar, its need to scroll together with the site, with the main scrollbar of the window...

I already try to make another div inside the fixed div with all the position atributes, with no sucess. so far:

    .furosimg {
    position: fixed !important;
    width: 181px;
    height: 200px;
    z-index:9;
    margin: 20px 0px 0px 470px;
    overflow: auto;
}

.furosimg .furosone {
    position: relative !important;
    width: 181px;
    height:900px;
    background:url(../images/topbg.png) center repeat-y;

}

any advices?

thanks!

Take a look at this example...all you gotta do is take the amount of window/document/body has scrolled and scroll the fixed element.

DEMO: http://jsfiddle.net/rgH56/4/

CODE

var f= document.getElementById('fi');

window.onscroll = function(){
    f.scrollTop=document.body.scrollTop;
}

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