位置是指元素相对于其容器的位置,通常在水平轴和垂直轴上。
在屏幕底部创建一个固定的选取框。但是,一旦物体固定,背景颜色(#ffffff)就会消失。我试过将它添加到几个不同的地方,但是没有运气。什么...
我想知道是否有人为此找到了解决方案?我正在寻找一种将元素附加到滚动容器HTML顶部的解决方案: ]]]]] 我认为您的解决方案通过position:sticky。似乎像position:fixed,但尊重其父母的相对位置。 遗憾的是,这是一项实验性功能,仅在Chromium中受支持。您可以在this test page中查看更多详细信息。 我想到的纯CSS解决方案是对标记进行了少许更改。您可以这样设置仅用于“元素”的容器: <div class="cont_elements"> <div class="element">......</div> ..... </div> 然后将溢出内容提供给该内部容器。现在,您的标题停留在顶部。 Here's a working demo。 jQuery UI为此添加了position()实用程序方法,这将使您的生活更轻松。 $( "#someElement" ).position({ of: //Element to position against, my: //which position on the element being positioned, at: //which position on the target element eg: horizontal/vertical, offset: // left-top values to the calculated position, eg. "50 50" }); 绝对帮助过我。 在这种情况下,解决方案是将标题弹出到滚动元素之外: <div class="header">title</div> <div class="container"> <div class="element">......</div> <div class="element">......</div> </div> 尽管可能的话,您可能应该拥有更好的语义元素(只是在这里猜测): <h3>title</h3> <ul> <li>......</li> <li>......</li> </ul> 您将找到有关此解决方案的最佳答案是此链接How to fixed scroll div after certain height and stop after reach other div? 我希望这可以节省一些谷歌搜索时间 var navWrap = $('#navWrap'), nav = $('nav'), startPosition = navWrap.offset().top, stopPosition = $('#stopHere').offset().top - nav.outerHeight(); $(document).scroll(function () { //stick nav to top of page var y = $(this).scrollTop() if (y > startPosition) { nav.addClass('sticky'); if (y > stopPosition) { nav.css('top', stopPosition - y); } else { nav.css('top', 0); } } else { nav.removeClass('sticky'); } }); body { height:1600px; margin:0; } #navWrap { height:70px } nav { height: 70px; background:gray; } .sticky { position: fixed; top:0; } h1 { margin: 0; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit morb ,o vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> <div id="navWrap"> <nav> <h1>I stick to the top when you scroll down and unstick when you scroll up to my original position</h1> </nav> </div> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit , morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit morb ,o vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> <br> <div id="stopHere"> <h3 style="color:red">I want it stop fixed scrolling here. If I'm back to scrolling up, It will follow also to original position.</h3> </div> <br> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit morb ,o vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit , morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit morb ,o vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit , morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> <p>Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit morb ,o vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium. Qui animated corpse, cricket bat max brucks terribilem incessu zomby. The voodoo sacerdos flesh eater, suscitat mortuos comedere carnem virus. Zonbi tattered for solum oculi eorum defunctis go lum cerebro. Nescio brains an Undead zombies. Sicut malus putrid voodoo horror. Nigh tofth eliv ingdead.</p> 这是我想出的使用position: sticky的解决方案(很遗憾,没有IE): https://codepen.io/waterplea/pen/JjjMXzR 想法是在滚动容器的顶部有一个0高度的粘性容器,因此它会粘住,但不会将任何内容压入下面,然后将您的内容绝对放置在其中。这样,您就可以拥有宽度,但没有高度,因此只能像我在示例中使用button那样从顶部定位一些东西。
glm :: mat4 yellow_bone_obj_mat = m_bone_animation-> get_yellow_mat(); glUniformMatrix4fv(glGetUniformLocation(shader.program,“ model”),1,GL_FALSE,glm :: value_ptr(yellow_bone_obj_mat)); bone_obj-> ...
我在页面上居中固定宽度的列。由于视口不同,因此边距未知。我想将其移到屏幕的左边缘而不将其从HTML流中删除。 &...
我正在努力计算pdf文本位置。我已经通过互联网阅读,但是没有成功。我已经阅读了pdf参考资料,但这是uhmmmm。现在,我写了一部分pdf文件,然后告诉您...
[将我的应用程序的WPF窗口与屏幕的左边框对齐时,我的代码为窗口的Left属性返回负值(-7,这是不希望的)。相同的代码在对等方的...上返回零...
我正在使用Cytoscape.js可视化网络。我目前正在使用可乐布局,当生成一个网络(具有零个孤儿节点)时,该布局可解决问题。但是,如果我添加其他网络...
一个大脚本的一部分创建了一个隐藏工作表的副本,然后将其从左侧移动到位置3,因为我已经将其姐妹工作表移动到了位置2。但是,我后来意识到...
GameObjects的结构:角色->武器-> ShotPoint如果我移动父项(角色),则子ShotPoint更改的全局位置(ShotPoint.transform.position)。如果...
我有一个项目,我在CSS中定位元素时遇到困难。我想创建一个带有联系人号码的标题,并在右侧和中心图片中显示电子邮件。下面是代码。建议...
在我公司,我们使用提供了一些布局模板的调查软件/平台。该平台允许CSS修改,我想在其上方的标题图像上放置一个进度条。 ...
我想制作一个像http://www.chacha.com这样的标题(不要移动,宽度和高度大约一样,并且可以将div放入其中,并且也必须是图像)我正在开始用一个空白的html ...
我正在尝试Tkinter,因为我试图放置树框。必须并排放置两个框架:红色框架和蓝色框架。 (请参阅框架图片)。我将这两个框架与此...
我在Safari和台式机和iOS中都有这个非常奇怪的问题。这是当前正在发生的屏幕快照(同样是iOS和桌面Safari):这是应该发生的事情的图片...
我需要在python中找到位置随时间变化的概率这是任务:一个女人从大坝下游约100 m的河上从独木舟上掉下来。我们不知道确切的位置...
offsetTop / getBoundingClientRect()。位置为粘滞的元素的顶部
[当元素的位置为:粘性时,到达其偏移量(例如,顶部:0)并在屏幕上停止,我无法正确获取其offsetTop,它显示的超出了必要。同时,我无法获得...