纵观 IT 行业这二十多年的发展,开源软件从黑客的“理想之国”,已经形成了一股推进计算机及相关行业不停进步的巨大力量。如今大热的大数据、区块链、人工智能、物联网、数据库领域,其中最为重要的、最受欢迎的技术也都是开源的。但是尽管如此,还是有超过一半以上的国内开发者鲜少参与开源项目,这种情况多少都令人遗憾。想听一听大家的看法,您如果没有参与,请分享下参与开源项目少的原因?... 展开详请
实这是可能的,而接受的答案只涉及集中,这是很直接的。你也真的不需要使用JavaScript。
这将让你处理任何情况:
设置好一切,你会如果你要的位置:位置内绝对的:相对的容器,然后创建一个DIV中一个新的固定位置格position: absolute,但没有设置它的顶部和左侧属性。然后将它固定在任何你想要的地方,相对于容器。
例如:
/* Main site body */
.wrapper {
width: 940px;
margin: 0 auto;
position: relative; /* Ensure absolute positioned child elements are relative to this*/
}
/* Absolute positioned wrapper for the element you want to fix position */
.fixed-wrapper {
width: 220px;
position: absolute;
top: 0;
left: -240px; /* Move this out to the left of the site body, leaving a 20px gutter */
}
/* The element you want to fix the position of */
.fixed {
width: 220px;
position: fixed;
/* Do not set top / left! */
}
<div class="wrapper">
<div class="fixed-wrapper">
<div class="fixed">
Content in here will be fixed position, but 240px to the left of the site body.
</div>
</div>
</div>... 展开详请