File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 11
11
All files in the package are distributed under the MIT License
12
12
'''
13
13
14
- __version__ = '2.9.6'
14
+ __version__ = '2.9.6.1 '
15
15
from .dynamic import display_quiz , capture_responses
Original file line number Diff line number Diff line change @@ -128,6 +128,22 @@ function check_numeric(ths, event) {
128
128
} else {
129
129
console . log ( 'MathJax not detected' ) ;
130
130
}
131
+ // After correct answer, if next JupyterQuiz question exists and has a text input, scroll by current question height
132
+ if ( correct ) {
133
+ // find the current question wrapper
134
+ var wrapper = ths . closest ( '.Quiz' ) ;
135
+ if ( wrapper ) {
136
+ var nextWrapper = wrapper . nextElementSibling ;
137
+ if ( nextWrapper && nextWrapper . classList . contains ( 'Quiz' ) ) {
138
+ var nextInput = nextWrapper . querySelector ( 'input.Input-text' ) ;
139
+ if ( nextInput ) {
140
+ var height = wrapper . getBoundingClientRect ( ) . height ;
141
+ console . log ( height ) ;
142
+ nextInput . focus ( ) ;
143
+ }
144
+ }
145
+ }
146
+ }
131
147
return false ;
132
148
}
133
149
Original file line number Diff line number Diff line change @@ -148,6 +148,20 @@ function check_string(ths, event) {
148
148
} else {
149
149
console . log ( 'MathJax not detected' ) ;
150
150
}
151
+ // After correct answer, if next JupyterQuiz question exists and has a text input, scroll by current question height
152
+ if ( correct ) {
153
+ var wrapper = ths . closest ( '.Quiz' ) ;
154
+ if ( wrapper ) {
155
+ var nextWrapper = wrapper . nextElementSibling ;
156
+ if ( nextWrapper && nextWrapper . classList . contains ( 'Quiz' ) ) {
157
+ var nextInput = nextWrapper . querySelector ( 'input.Input-text' ) ;
158
+ if ( nextInput ) {
159
+ var height = wrapper . getBoundingClientRect ( ) . height ;
160
+ nextInput . focus ( ) ;
161
+ }
162
+ }
163
+ }
164
+ }
151
165
return false ;
152
166
}
153
167
}
You can’t perform that action at this time.
0 commit comments