Using fixed position with a grid layout framework

自古美人都是妖i 提交于 2019-12-04 03:38:32
cosmicdot

Found this article - ZURB + ScrollSpy. Got it working in 5 mins. What I found that wrapping the sidebar content in scrollspy div underneath the grid position.

Using javascript to solve a problem like this seems like overkill. I would try to keep to the basics by using Foundation's offset classes like this:

<div class="row twelve columns">
  <div class="two columns" style="position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto;">
    Menu
    <ul><li>Menu Item</li></ul>
  </div>
  <div class="ten columns offset-by-two">
    Content goes here
  </div>
</div>

Hope this helps!

Ian128K

Seems to me that if you're going to have a component of the page that's fixed anyway, the easiest thing to do is just pull that div out of the 'Foundation' grid altogether. Then, outside of the grid, you can position it as fixed and it won't interact with the grid at all. If the menu itself also needs to be a flexible grid, make it one—just make it separate from the main grid.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!