V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hxd
V2EX  ›  Ruby on Rails

请教油猴脚本: 怎么把原来一个整体的页面划分成两个模块?

  •  
  •   hxd · 2016-06-23 16:48:02 +08:00 · 3406 次点击
    这是一个创建于 2836 天前的主题,其中的信息可能已经有所发展或是发生改变。

    起因: 翻 ruby 在线文档页面时,希望左边那些导航标签能相对固定住, 滚动 /跳转页面时只是右边内容部分动。 比如这个页面: http://ruby-doc.org/core-2.3.1/Array.html 想划成左右两块,左边点击时右边跳动,而左右两边能独立的下拉滚动等。

    请问这个能做到吗? 烦请老司机带路,谢谢!

    5 条回复    2016-06-23 18:59:06 +08:00
    hcwhan
        1
    hcwhan  
       2016-06-23 16:53:26 +08:00 via Android
    css 固定定位
    hcwhan
        2
    hcwhan  
       2016-06-23 16:55:15 +08:00 via Android   ❤️ 1
    sorry 请无视我 只看了标题,,
    kokdemo
        3
    kokdemo  
       2016-06-23 17:08:39 +08:00
    让左右两边 div 的 display 设置成 inline-block , height 100vh (或者 100%), overflow-y 写成 scroll
    quix
        4
    quix  
       2016-06-23 18:00:46 +08:00   ❤️ 1
    左边改成 postion: fixed 内部加 overflow: auto, 右边不需要动
    muzuiget
        5
    muzuiget  
       2016-06-23 18:59:06 +08:00   ❤️ 1
    不谢

    (function(cssText) {
    var head = document.querySelector('head');
    var style = document.createElement('style');
    style.setAttribute('type', 'text/css');
    style.textContent = cssText;
    head.appendChild(style);
    })(`
    .class #metadata, .file #metadata, .module #metadata {
    float: left;
    height: 100vh;
    overflow: auto;
    position: sticky;
    top: 0;
    width: 260px;`)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2878 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:25 · PVG 19:25 · LAX 04:25 · JFK 07:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.