Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
CookSleep authored Jul 24, 2024
1 parent c3c27c3 commit b9fe636
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
28 changes: 12 additions & 16 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,17 @@ function displayResults(results) {
const newHeight = tempContainer.scrollHeight;

// Set the new height before starting the animation
requestAnimationFrame(() => {
animateResultsContainer(originalHeight, newHeight, () => {
results.forEach((r, index) => {
const resultItem = document.createElement('div');
resultItem.classList.add('result-item', 'slide-down');
resultItem.style.animationDelay = `${index * 0.05}s`;
resultItem.innerHTML = `
<span class="rank">#${index + 1}</span>
<span class="provider">${r.name}</span>
<span class="cost">${r.costCNY.toFixed(4)} CNY / ${r.costUSD.toFixed(4)} USD</span>
`;
resultsList.appendChild(resultItem);
});
animateResultsContainer(originalHeight, newHeight, () => {
results.forEach((r, index) => {
const resultItem = document.createElement('div');
resultItem.classList.add('result-item', 'slide-down');
resultItem.style.animationDelay = `${index * 0.05}s`;
resultItem.innerHTML = `
<span class="rank">#${index + 1}</span>
<span class="provider">${r.name}</span>
<span class="cost">${r.costCNY.toFixed(4)} CNY / ${r.costUSD.toFixed(4)} USD</span>
`;
resultsList.appendChild(resultItem);
});
});
}
Expand Down Expand Up @@ -252,9 +250,7 @@ function clearResultsList(container, items) {

setTimeout(() => {
container.innerHTML = '';
animateResultsContainer(originalHeight, container.scrollHeight);
resultsContainerHeight = container.scrollHeight;
resolve();
animateResultsContainer(originalHeight, container.scrollHeight, resolve);
}, 500);
});
}
Expand Down
7 changes: 4 additions & 3 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ h1 {
transition: color 0.3s ease;
font-size: 0.9em;
align-self: flex-start;

}

.github-link:hover {
Expand Down Expand Up @@ -509,11 +508,13 @@ select {
}

.slide-down {
animation: slideDown 0.5s ease-out forwards;
animation: slideDown 0.5s forwards;
transform-origin: top;
}

.slide-up {
animation: slideUp 0.5s ease-out forwards;
animation: slideUp 0.5s forwards;
transform-origin: top;
}

input:checked + .slider {
Expand Down

0 comments on commit b9fe636

Please sign in to comment.