简体   繁体   English

固定div与滚动内的内容

[英]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... 我试图做以下事情:固定的div始终保持在页面中,这里没有任何困难,但是在这个div中,我需要放置一些将与网站其余部分一起滚动的内容,请注意该内容没有他的自己的滚动条,它需要与站点一起滚动,与窗口的主滚动条一起滚动...

I already try to make another div inside the fixed div with all the position atributes, with no sucess. 我已经尝试在固定div内制作另一个具有所有位置属性且没有成功的div。 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/ 演示: http : //jsfiddle.net/rgH56/4/

CODE

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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