From 8e9c23235a5f56b6806b059b2c29ca93b85e3b6a Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 27 Nov 2014 16:37:07 +0100 Subject: [PATCH] [IMP] ws doc: affix language switcher to page top --- doc/_themes/odoodoc/static/app.js | 5 +++-- doc/_themes/odoodoc/static/style.css | 10 +++++++--- doc/_themes/odoodoc/static/style.less | 10 +++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/_themes/odoodoc/static/app.js b/doc/_themes/odoodoc/static/app.js index 47c33f41d23..a0d7376530a 100644 --- a/doc/_themes/odoodoc/static/app.js +++ b/doc/_themes/odoodoc/static/app.js @@ -77,7 +77,7 @@ $(function () { var sheet = findSheet(/style\.css$/); if (!sheet) { return; } // build PL switcher UI and hook toggle event - $(buildSwitcher(Object.keys(languages))) + var $switcher = $(buildSwitcher(Object.keys(languages))) .prependTo('div.documentwrapper') .on('click', 'li', function (e) { $(e.target).addClass('active') @@ -93,7 +93,8 @@ $(function () { ].join(''); sheet.deleteRule(lastIndex); sheet.insertRule(sel + '{' + content + '}', lastIndex); - }); + }); + $switcher.affix(); })(); } diff --git a/doc/_themes/odoodoc/static/style.css b/doc/_themes/odoodoc/static/style.css index 9458adbaca2..96e2bba97a0 100644 --- a/doc/_themes/odoodoc/static/style.css +++ b/doc/_themes/odoodoc/static/style.css @@ -7248,7 +7248,7 @@ td.field-body > ul { color: white; width: auto !important; float: none !important; - position: fixed; + position: absolute; display: -webkit-flex; display: flex; -webkit-justify-content: flex-end; @@ -7259,6 +7259,10 @@ td.field-body > ul { margin: 0; z-index: 5; } +.stripe .switcher.affix { + position: fixed; + top: 0; +} .stripe .switcher li { background-color: #0f131a; padding: 0.4em 1em; @@ -7268,10 +7272,10 @@ td.field-body > ul { } .stripe .switcher li:first-child { border-left-width: 1px; - border-radius: 5px 0 0 5px; + border-radius: 0 0 0 5px; } .stripe .switcher li:last-child { - border-radius: 0 5px 5px 0; + border-radius: 0 0 5px 0; } .stripe .switcher li:hover { background-color: #222; diff --git a/doc/_themes/odoodoc/static/style.less b/doc/_themes/odoodoc/static/style.less index d715bb13868..258990067d8 100644 --- a/doc/_themes/odoodoc/static/style.less +++ b/doc/_themes/odoodoc/static/style.less @@ -767,7 +767,7 @@ td.field-body { width: auto !important; float: none !important; - position: fixed; + position: absolute; display: -webkit-flex; display: flex; -webkit-justify-content: flex-end; @@ -778,6 +778,10 @@ td.field-body { padding: 0; margin: 0; z-index: 5; + &.affix { + position: fixed; + top: 0; + } li { background-color: #0f131a; @@ -787,10 +791,10 @@ td.field-body { cursor: pointer; &:first-child { border-left-width: 1px; - border-radius: 5px 0 0 5px; + border-radius: 0 0 0 5px; } &:last-child { - border-radius: 0 5px 5px 0; + border-radius: 0 0 5px 0; } &:hover { background-color: #222;