Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +15 -0
templates/index.html
CHANGED
|
@@ -23,6 +23,21 @@
|
|
| 23 |
</div>
|
| 24 |
</div>
|
| 25 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
const flipBtn = document.getElementById('flipBtn');
|
| 27 |
let showingEnglish = true;
|
| 28 |
const englishText = "<strong>English:</strong> {{ english }}";
|
|
|
|
| 23 |
</div>
|
| 24 |
</div>
|
| 25 |
<script>
|
| 26 |
+
// Flashcardのズームを調整
|
| 27 |
+
function adjustFlashcardScale() {
|
| 28 |
+
const flashcard = document.getElementById('flashcard');
|
| 29 |
+
const windowWidth = window.innerWidth;
|
| 30 |
+
const flashcardWidth = flashcard.offsetWidth;
|
| 31 |
+
|
| 32 |
+
// スケールを計算して適用
|
| 33 |
+
const scale = windowWidth / flashcardWidth;
|
| 34 |
+
flashcard.style.transform = `scale(${scale})`;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// ページロード時とリサイズ時にスケールを適用
|
| 38 |
+
window.addEventListener('load', adjustFlashcardScale);
|
| 39 |
+
window.addEventListener('resize', adjustFlashcardScale);
|
| 40 |
+
|
| 41 |
const flipBtn = document.getElementById('flipBtn');
|
| 42 |
let showingEnglish = true;
|
| 43 |
const englishText = "<strong>English:</strong> {{ english }}";
|