Pp commited on
Commit
1f7d7d4
·
verified ·
1 Parent(s): 7f9d160

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +140 -18
index.html CHANGED
@@ -1,19 +1,141 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Learn About Flowers!</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ /* Use Inter font */
10
+ body {
11
+ font-family: 'Inter', sans-serif;
12
+ overscroll-behavior: none; /* Prevent pull-to-refresh */
13
+ }
14
+ /* Custom styles for SVG parts */
15
+ .flower-part {
16
+ cursor: pointer;
17
+ transition: filter 0.3s ease, transform 0.3s ease;
18
+ /* Add a subtle drop shadow for better definition */
19
+ filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
20
+ }
21
+ .flower-part:hover {
22
+ filter: brightness(1.1) drop-shadow(0 4px 4px rgba(0,0,0,0.3));
23
+ transform: scale(1.03); /* Slightly enlarge on hover */
24
+ }
25
+ .flower-part.selected {
26
+ filter: brightness(1.2) drop-shadow(0 5px 5px rgba(0,0,0,0.4));
27
+ stroke: #3b82f6; /* Blue outline when selected */
28
+ stroke-width: 3; /* Adjusted stroke width slightly for larger size */
29
+ transform: scale(1.05);
30
+ }
31
+ /* Style for the description box */
32
+ #description-box {
33
+ min-height: 100px; /* Ensure space even when empty */
34
+ transition: background-color 0.3s ease;
35
+ }
36
+ </style>
37
+ </head>
38
+ <body class="bg-gradient-to-br from-green-100 to-blue-100 min-h-screen flex flex-col items-center justify-center p-4">
39
+
40
+ <div class="bg-white rounded-lg shadow-xl p-6 w-full max-w-4xl text-center">
41
+ <h1 class="text-3xl font-bold text-pink-600 mb-4">Explore the Parts of a Flower!</h1>
42
+ <p class="text-gray-700 mb-6">Click on a part of the flower below to learn its name and what it does.</p>
43
+
44
+ <div class="flex flex-col md:flex-row items-center justify-center gap-8">
45
+ <div class="w-full md:w-1/2 flex justify-center">
46
+ <svg id="flower-svg" viewBox="0 0 200 250" class="w-96 h-auto"> {/* Changed w-64 to w-96 */}
47
+ <line x1="100" y1="150" x2="100" y2="240" stroke="green" stroke-width="5" />
48
+
49
+ <path id="sepal1" data-name="Sepals" data-description="These small green leaves protect the flower bud before it opens." class="flower-part fill-green-600" d="M 100 150 Q 90 160 85 170 T 90 180 L 100 150 Z" />
50
+ <path id="sepal2" data-name="Sepals" data-description="These small green leaves protect the flower bud before it opens." class="flower-part fill-green-600" d="M 100 150 Q 110 160 115 170 T 110 180 L 100 150 Z" />
51
+ <path id="sepal3" data-name="Sepals" data-description="These small green leaves protect the flower bud before it opens." class="flower-part fill-green-600" d="M 100 150 Q 85 155 75 160 T 80 175 L 100 150 Z" transform="rotate(10 100 150)" />
52
+ <path id="sepal4" data-name="Sepals" data-description="These small green leaves protect the flower bud before it opens." class="flower-part fill-green-600" d="M 100 150 Q 115 155 125 160 T 120 175 L 100 150 Z" transform="rotate(-10 100 150)" />
53
+
54
+
55
+ <path id="petal1" data-name="Petal" data-description="Petals are often bright and colorful to attract bees and butterflies for pollination." class="flower-part fill-pink-400" d="M 100 150 Q 100 100 140 100 T 150 140 L 100 150 Z" />
56
+ <path id="petal2" data-name="Petal" data-description="Petals are often bright and colorful to attract bees and butterflies for pollination." class="flower-part fill-pink-400" d="M 100 150 Q 100 100 60 100 T 50 140 L 100 150 Z" />
57
+ <path id="petal3" data-name="Petal" data-description="Petals are often bright and colorful to attract bees and butterflies for pollination." class="flower-part fill-pink-400" d="M 100 150 Q 60 130 50 80 T 90 60 L 100 150 Z" />
58
+ <path id="petal4" data-name="Petal" data-description="Petals are often bright and colorful to attract bees and butterflies for pollination." class="flower-part fill-pink-400" d="M 100 150 Q 140 130 150 80 T 110 60 L 100 150 Z" />
59
+ <path id="petal5" data-name="Petal" data-description="Petals are often bright and colorful to attract bees and butterflies for pollination." class="flower-part fill-pink-400" d="M 100 150 Q 100 180 130 190 T 100 150 Z" transform="rotate(180 100 150)" />
60
+
61
+
62
+ <ellipse id="ovary" data-name="Ovary" data-description="The ovary is at the bottom of the pistil and contains tiny ovules that can become seeds." class="flower-part fill-green-300" cx="100" cy="145" rx="10" ry="7" />
63
+ <line id="style" data-name="Style" data-description="The style is the stalk that connects the stigma to the ovary." class="flower-part" x1="100" y1="140" x2="100" y2="120" stroke="#a3e635" stroke-width="3" />
64
+ <circle id="stigma" data-name="Stigma" data-description="The stigma is the sticky top part of the pistil that catches pollen." class="flower-part fill-yellow-500" cx="100" cy="118" r="5" />
65
+
66
+ <line id="filament1" data-name="Filament" data-description="The filament is the thin stalk that holds up the anther." class="flower-part" x1="85" y1="140" x2="80" y2="125" stroke="#fbbf24" stroke-width="2" />
67
+ <line id="filament2" data-name="Filament" data-description="The filament is the thin stalk that holds up the anther." class="flower-part" x1="115" y1="140" x2="120" y2="125" stroke="#fbbf24" stroke-width="2" />
68
+ <line id="filament3" data-name="Filament" data-description="The filament is the thin stalk that holds up the anther." class="flower-part" x1="90" y1="145" x2="75" y2="135" stroke="#fbbf24" stroke-width="2" />
69
+ <line id="filament4" data-name="Filament" data-description="The filament is the thin stalk that holds up the anther." class="flower-part" x1="110" y1="145" x2="125" y2="135" stroke="#fbbf24" stroke-width="2" />
70
+
71
+ <ellipse id="anther1" data-name="Anther" data-description="The anther is at the top of the stamen and makes pollen." class="flower-part fill-orange-500" cx="80" cy="123" rx="4" ry="3" />
72
+ <ellipse id="anther2" data-name="Anther" data-description="The anther is at the top of the stamen and makes pollen." class="flower-part fill-orange-500" cx="120" cy="123" rx="4" ry="3" />
73
+ <ellipse id="anther3" data-name="Anther" data-description="The anther is at the top of the stamen and makes pollen." class="flower-part fill-orange-500" cx="75" cy="133" rx="4" ry="3" />
74
+ <ellipse id="anther4" data-name="Anther" data-description="The anther is at the top of the stamen and makes pollen." class="flower-part fill-orange-500" cx="125" cy="133" rx="4" ry="3" />
75
+
76
+ </svg>
77
+ </div>
78
+
79
+ <div id="description-box" class="w-full md:w-1/2 bg-blue-50 rounded-lg p-4 border border-blue-200 shadow-inner text-left">
80
+ <h2 id="part-name" class="text-xl font-semibold text-blue-800 mb-2">Flower Part Name</h2>
81
+ <p id="part-description" class="text-gray-700">Click on a part of the flower to learn more!</p>
82
+ </div>
83
+ </div>
84
+ </div>
85
+
86
+ <script>
87
+ // Get references to HTML elements
88
+ const flowerParts = document.querySelectorAll('.flower-part');
89
+ const partNameElement = document.getElementById('part-name');
90
+ const partDescriptionElement = document.getElementById('part-description');
91
+ const descriptionBox = document.getElementById('description-box');
92
+ let selectedPart = null; // Keep track of the currently selected part
93
+
94
+ // Add click event listener to each flower part
95
+ flowerParts.forEach(part => {
96
+ part.addEventListener('click', (event) => {
97
+ // Prevent click event from bubbling up to parent elements if necessary
98
+ event.stopPropagation();
99
+
100
+ // Get the name and description from data attributes
101
+ const name = part.dataset.name;
102
+ const description = part.dataset.description;
103
+
104
+ // Update the description box
105
+ partNameElement.textContent = name;
106
+ partDescriptionElement.textContent = description;
107
+ descriptionBox.classList.remove('bg-blue-50'); // Reset background
108
+ descriptionBox.classList.add('bg-yellow-100'); // Indicate update
109
+
110
+ // Remove 'selected' class from previously selected part
111
+ if (selectedPart) {
112
+ selectedPart.classList.remove('selected');
113
+ }
114
+
115
+ // Add 'selected' class to the clicked part
116
+ part.classList.add('selected');
117
+ selectedPart = part; // Update the selected part
118
+
119
+ // Optional: Reset background color after a short delay
120
+ setTimeout(() => {
121
+ descriptionBox.classList.remove('bg-yellow-100');
122
+ descriptionBox.classList.add('bg-blue-50');
123
+ }, 500); // 0.5 seconds
124
+ });
125
+ });
126
+
127
+ // Optional: Add a click listener to the body to deselect if clicking outside the flower
128
+ document.body.addEventListener('click', (event) => {
129
+ // Check if the click was outside the SVG flower area
130
+ if (!event.target.closest('#flower-svg') && selectedPart) {
131
+ selectedPart.classList.remove('selected');
132
+ selectedPart = null;
133
+ partNameElement.textContent = 'Flower Part Name'; // Reset title
134
+ partDescriptionElement.textContent = 'Click on a part of the flower to learn more!'; // Reset description
135
+ }
136
+ });
137
+
138
+ </script>
139
+ </body>
140
  </html>
141
+