File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 30
30
<!-- Scratchpad gets populated through call to .Inner -->
31
31
{{- .Inner -}}
32
32
33
- < ul class ="nav nav-tabs " id ="tabs-{{- $.Ordinal -}} " role ="tablist ">
33
+ < ul class ="nav nav-tabs{{ if $persistLang }} persist{{ end }} " id ="tabs-{{- $.Ordinal -}} " role ="tablist ">
34
34
{{- range $index, $element := $.Scratch.Get "tabs" -}}
35
35
36
36
{{- $lang := $langPane -}}
75
75
{{ $activeSet = false }}
76
76
77
77
<!-- Inner content -->
78
- < div class ="tab-content " id ="tabs-{{- $.Ordinal -}}-content ">
78
+ < div class ="tab-content{{ if $persistLang }} persist{{ end }} " id ="tabs-{{- $.Ordinal -}}-content ">
79
79
{{- range $index, $element := $.Scratch.Get "tabs" -}}
80
80
81
81
{{- $lang := $langPane -}}
Original file line number Diff line number Diff line change 1
1
<!-- Upstream docsy commit — ecd4be87ea48e8e94684e32c925049e9bdf7f127-->
2
+ var tabContents = document . querySelectorAll ( '.tab-content.persist' ) ;
3
+ if ( tabContents . length > 1 ) {
4
+ const persistTab = document . querySelector ( 'ul.persist' ) . querySelectorAll ( '.nav-link' ) ;
5
+ var heightMap = { } ;
6
+
7
+ // select each persist tab and store calculated heights
8
+ persistTab . forEach ( ( langTab ) => {
9
+ langTab . click ( ) ;
10
+ tabContents . forEach ( ( tabContent ) => {
11
+ heightMap [ tabContent . id ] ||= [ ] ;
12
+ heightMap [ tabContent . id ] . push ( tabContent . clientHeight ) ;
13
+ } )
14
+ // everything ends up active unless classes removed
15
+ document . querySelectorAll ( '.active.show' ) . forEach ( ( activeTab ) => {
16
+ activeTab . classList . remove ( 'active' ) ;
17
+ activeTab . classList . remove ( 'show' ) ;
18
+ } )
19
+ } )
20
+ // need to make something active/shown again
21
+ persistTab [ 0 ] . click ( ) ;
22
+
23
+ tabContents . forEach ( ( tabContent ) => {
24
+ tabContent . style . height = Math . max . apply ( Math , heightMap [ tabContent . id ] ) . toString ( ) + 'px' ;
25
+ } )
26
+ }
27
+
2
28
if ( typeof Storage !== 'undefined' ) {
3
29
let activeLanguage = localStorage . getItem ( 'active_language' ) ;
4
30
You can’t perform that action at this time.
0 commit comments