feat(video-cards): add click navigation to video and shorts cards
Implement click event handlers for video cards, shorts cards, and search results to navigate to their respective detail pages. Also adjust grid layout dimensions for better responsiveness.
This commit is contained in:
15
js/script.js
15
js/script.js
@@ -619,6 +619,11 @@ function createVideoCard(video) {
|
||||
menuDropdown.classList.remove('show');
|
||||
});
|
||||
|
||||
// Add click event to the card
|
||||
card.addEventListener('click', () => {
|
||||
window.location.href = `video.html?id=${video.id}`;
|
||||
});
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
@@ -639,6 +644,11 @@ function createShortsCard(video) {
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Add click event to the card
|
||||
card.addEventListener('click', () => {
|
||||
window.location.href = `short.html?id=${video.id}`;
|
||||
});
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
@@ -714,6 +724,11 @@ function renderSearchResults(results, query) {
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Add click event to the search result item
|
||||
item.addEventListener('click', () => {
|
||||
window.location.href = `video.html?id=${video.id}`;
|
||||
});
|
||||
|
||||
searchResultsContent.appendChild(item);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user