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

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

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

    腾讯云最新优惠活动来了:云产品限时1折,云服务器低至88元/年 ,点击这里立即抢购:9i0i.cn/qcloud,更有2860元代金券免费领取,付款直接抵现金用,点击这里立即领取:9i0i.cn/qcloudquan

    (福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

    起因: 翻 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   ·   我们的愿景   ·   实用小工具   ·   998 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 21:44 · PVG 05:44 · LAX 14:44 · JFK 17:44
    Developed with CodeLauncher
    ? Do have faith in what you're doing.


    http://www.vxiaotou.com