Centre for Process Innovation (CPI), UK, propels scientific research forward with Agaram’s Logilab ELN Click Here

Interested In Our Product Services?
Request A Demo Email US Contact Us
${video.title}
${video.desc}
${video.button}
`; return videoItem; } // Function to filter and paginate videos function filterAndPaginateVideos(type, page) { const startIndex = (page - 1) * videosPerPage; const endIndex = startIndex + videosPerPage; const filteredVideos = filterVideos(type); return filteredVideos.slice(startIndex, endIndex); } // Function to render video grid function renderVideoGrid(type, page) { const videoGrid = document.getElementById('video-grid'); videoGrid.innerHTML = ''; const videosToDisplay = filterAndPaginateVideos(type, page); if (videosToDisplay.length === 0) { document.getElementById('no-videos').style.display = 'block'; } else { document.getElementById('no-videos').style.display = 'none'; } videosToDisplay.forEach(video => { const videoItem = createVideoItem(video); videoGrid.appendChild(videoItem); }); } // Function to render pagination controls function renderPagination(type, currentPage) { const pagination = document.getElementById('pagination'); pagination.innerHTML = ''; const filteredVideos = filterVideos(type); const totalPages = Math.ceil(filteredVideos.length / videosPerPage); for (let i = 1; i <= totalPages; i++) { const pageButton = document.createElement('button'); pageButton.textContent = i; pageButton.addEventListener('click', () => { currentPage = i; renderVideoGrid(type, currentPage); renderPagination(type, currentPage); }); if (i === currentPage) { pageButton.classList.add('active'); } pagination.appendChild(pageButton); } } // Function to filter videos based on type function filterVideos(type) { return type === 'all' ? videoData : videoData.filter(video => video.type === type); } // Event listener for dropdown filter const filterDropdown = document.getElementById('filter'); filterDropdown.addEventListener('change', function () { currentPage = 1; const selectedType = this.value; renderVideoGrid(selectedType, currentPage); renderPagination(selectedType, currentPage); }); // Initial rendering renderVideoGrid('all', currentPage); renderPagination('all', currentPage); -->