diff --git a/README.md b/README.md index a8e78ee4..586930d8 100755 --- a/README.md +++ b/README.md @@ -195,4 +195,3 @@ In addition to these plugins, Interactive book also inherit's all the plugins us ### Create, Contribute, Learn, and succeed with CircuitVerse!!! Interactive-Book is © 2026 by [CircuitVerse](https://circuitverse.org/) - diff --git a/_sass/quiz-feedback.scss b/_sass/quiz-feedback.scss new file mode 100644 index 00000000..29a5097d --- /dev/null +++ b/_sass/quiz-feedback.scss @@ -0,0 +1,100 @@ +// Quiz feedback styles + +$color-correct-bg: #d4edda; +$color-correct-border: #28a745; +$color-correct-text: #155724; +$color-incorrect-bg: #f8d7da; +$color-incorrect-border: #dc3545; +$color-incorrect-text: #721c24; +$color-reset-bg: #6c757d; +$color-reset-hover: #5a6268; +$color-reset-text: #ffffff; +$color-dark-correct-bg: #1e3a28; +$color-dark-correct-border: #28a745; +$color-dark-correct-text: #7fdb9f; +$color-dark-incorrect-bg: #3a1e1e; +$color-dark-incorrect-border: #dc3545; +$color-dark-incorrect-text: #f5b7bd; +$color-dark-shadow: rgba(255, 255, 255, 0.1); + +// Correct answer styling +.feedback-correct { + animation: correct-pulse 0.5s ease; + background-color: $color-correct-bg; + border: 1px solid $color-correct-border; + border-radius: 4px; + color: $color-correct-text; + margin-top: 0.5rem; + padding: 0.75rem; +} + +// Incorrect answer styling +.feedback-incorrect { + animation: incorrect-shake 0.5s ease; + background-color: $color-incorrect-bg; + border: 1px solid $color-incorrect-border; + border-radius: 4px; + color: $color-incorrect-text; + margin-top: 0.5rem; + padding: 0.75rem; +} + +// Feedback message +.feedback-message { + font-size: 0.95rem; + line-height: 1.6; + margin-bottom: 1rem; +} + +// Reset button +.quiz-reset-btn { + background-color: $color-reset-bg; + border: 0; + border-radius: 4px; + color: $color-reset-text; + cursor: pointer; + font-size: 0.9rem; + padding: 0.5rem 1rem; + transition: background-color 0.2s ease; + + &:hover { + background-color: $color-reset-hover; + } + + &:active { + transform: scale(0.98); + } +} + +// Dark mode adjustments +.dark-mode { + .feedback-correct { + background-color: $color-dark-correct-bg; + border-color: $color-dark-correct-border; + color: $color-dark-correct-text; + } + + .feedback-incorrect { + background-color: $color-dark-incorrect-bg; + border-color: $color-dark-incorrect-border; + color: $color-dark-incorrect-text; + } + + .quiz-feedback { + box-shadow: 0 2px 8px $color-dark-shadow; + } +} + +// Animations +@keyframes correct-pulse { + 0% { transform: scale(1); } + 50% { transform: scale(1.02); } + 100% { transform: scale(1); } +} + +@keyframes incorrect-shake { + 0% { transform: translateX(0); } + 25% { transform: translateX(-5px); } + 75% { transform: translateX(5px); } + 100% { transform: translateX(0); } +} diff --git a/assets/css/just-the-docs-circuitverse.scss b/assets/css/just-the-docs-circuitverse.scss index 8ca3178f..53635b1a 100644 --- a/assets/css/just-the-docs-circuitverse.scss +++ b/assets/css/just-the-docs-circuitverse.scss @@ -1,3 +1,5 @@ --- --- {% include css/just-the-docs.scss.liquid color_scheme="circuitverse" %} + +@import "quiz-feedback"; \ No newline at end of file diff --git a/assets/css/just-the-docs-circuitversedark.scss b/assets/css/just-the-docs-circuitversedark.scss index f88fa83b..163111a5 100644 --- a/assets/css/just-the-docs-circuitversedark.scss +++ b/assets/css/just-the-docs-circuitversedark.scss @@ -4,4 +4,6 @@ .text-grey-dk-100 { color: white!important; -} \ No newline at end of file +} + +@import "quiz-feedback"; \ No newline at end of file diff --git a/assets/js/quiz.js b/assets/js/quiz.js index 7322aa80..5954a595 100644 --- a/assets/js/quiz.js +++ b/assets/js/quiz.js @@ -15,16 +15,31 @@ $(function() { question.append('Question ' + questionNo + ''); question.append('
' + questionText + '
'); - // Get answers var answers = []; - $(this).find('ul').each(function() { + + // Correct answers from