348 | ├── README.md ├── script.js ├── index.html └── style.css /README.md: -------------------------------------------------------------------------------- 1 | # awesome-video-platform 2 | 3 | video platform using CSS and JavaScript 4 | 5 | 6 | ## Technologies used 7 | 8 | * HTML 9 | * CSS 10 | * JavaScript 11 | 12 | ## live site 13 | 14 | https://peter-kimanzi.github.io/awesome-video-platform/ 15 | 16 | ## screenshots 17 | 18 |  19 | 20 |  21 | 22 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | $(".sidebar-link").click(function () { 3 | $(".sidebar-link").removeClass("is-active"); 4 | $(this).addClass("is-active"); 5 | }); 6 | }); 7 | 8 | $(window) 9 | .resize(function () { 10 | if ($(window).width() > 1090) { 11 | $(".sidebar").removeClass("collapse"); 12 | } else { 13 | $(".sidebar").addClass("collapse"); 14 | } 15 | }) 16 | .resize(); 17 | 18 | const allVideos = document.querySelectorAll(".video"); 19 | 20 | allVideos.forEach((v) => { 21 | v.addEventListener("mouseover", () => { 22 | const video = v.querySelector("video"); 23 | video.play(); 24 | }); 25 | v.addEventListener("mouseleave", () => { 26 | const video = v.querySelector("video"); 27 | video.pause(); 28 | }); 29 | }); 30 | 31 | $(function () { 32 | $(".logo, .logo-expand, .discover").on("click", function (e) { 33 | $(".main-container").removeClass("show"); 34 | $(".main-container").scrollTop(0); 35 | }); 36 | $(".trending, .video").on("click", function (e) { 37 | $(".main-container").addClass("show"); 38 | $(".main-container").scrollTop(0); 39 | $(".sidebar-link").removeClass("is-active"); 40 | $(".trending").addClass("is-active"); 41 | }); 42 | 43 | $(".video").click(function () { 44 | var source = $(this).find("source").attr("src"); 45 | var title = $(this).find(".video-name").text(); 46 | var person = $(this).find(".video-by").text(); 47 | var img = $(this).find(".author-img").attr("src"); 48 | $(".video-stream video").stop(); 49 | $(".video-stream source").attr("src", source); 50 | $(".video-stream video").load(); 51 | $(".video-p-title").text(title); 52 | $(".video-p-name").text(person); 53 | $(".video-detail .author-img").attr("src", img); 54 | }); 55 | }); -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
348 |