{"id":494,"date":"2025-06-19T12:44:31","date_gmt":"2025-06-19T07:14:31","guid":{"rendered":"http:\/\/virtualhax.com\/?p=494"},"modified":"2025-06-19T12:44:25","modified_gmt":"2025-06-19T07:14:25","slug":"how-to-add-youtube-like-loading-bar-to-website-using-html-css-javascript","status":"publish","type":"post","link":"https:\/\/veewom.com\/articles\/how-to-add-youtube-like-loading-bar-to-website-using-html-css-javascript.htm","title":{"rendered":"How To Add a YouTube Like Loading Bar to Your Website Using HTML,CSS and JavaScript?"},"content":{"rendered":"<p>Hello everyone, in this article we are going to show you, how to add a youtube type loading bar to your website using css,HTML and javascript code, so here is very simple to add youtube type loading bar, you can use simple css and javascript code you existing website , so no more discussion and let&#8217;s start.<\/p>\n<h2>#01 CSS Code<\/h2>\n<pre><code class=\"css\">\r\n#progress {\r\nposition: fixed;\r\nz-index: 2147483647;\r\ntop: 0;\r\nleft: -6px;\r\nwidth: 0%;\r\nheight: 2px;\r\nbackground: #b91f1f;\r\n-moz-border-radius: 1px;\r\n-webkit-border-radius: 1px;\r\nborder-radius: 1px;\r\n-moz-transition: width 500ms ease-out,opacity 400ms linear;\r\n-ms-transition: width 500ms ease-out,opacity 400ms linear;\r\n-o-transition: width 500ms ease-out,opacity 400ms linear;\r\n-webkit-transition: width 500ms ease-out,opacity 400ms linear;\r\ntransition: width 500ms ease-out,opacity 400ms linear\r\n}\r\n#progress.done {\r\nopacity: 0\r\n}\r\n#progress dd,#progress dt {\r\nposition: absolute;\r\ntop: 0;\r\nheight: 2px;\r\n-moz-box-shadow: #b91f1f 1px 0 6px 1px;\r\n-ms-box-shadow: #b91f1f 1px 0 6px 1px;\r\n-webkit-box-shadow: #b91f1f 1px 0 6px 1px;\r\nbox-shadow: #b91f1f 1px 0 6px 1px;\r\n-moz-border-radius: 100%;\r\n-webkit-border-radius: 100%;\r\nborder-radius: 100%\r\n}\r\n#progress dd {\r\nopacity: 1;\r\nwidth: 20px;\r\nright: 0;\r\nclip: rect(-6px,22px,14px,10px)\r\n}\r\n#progress dt {\r\nopacity: 1;\r\nwidth: 180px;\r\nright: -80px;\r\nclip: rect(-6px,90px,14px,-6px)\r\n}\r\n@-moz-keyframes pulse {\r\n30% {\r\nopacity: 1\r\n}\r\n60% {\r\nopacity: 0\r\n}\r\n100% {\r\nopacity: 1\r\n}\r\n}\r\n@-ms-keyframes pulse {\r\n30% {\r\nopacity: .6\r\n}\r\n60% {\r\nopacity: 0\r\n}\r\n100% {\r\nopacity: .6\r\n}\r\n}\r\n@-o-keyframes pulse {\r\n30% {\r\nopacity: 1\r\n}\r\n60% {\r\nopacity: 0\r\n}\r\n100% {\r\nopacity: 1\r\n}\r\n}\r\n@-webkit-keyframes pulse {\r\n30% {\r\nopacity: .6\r\n}\r\n60% {\r\nopacity: 0\r\n}\r\n100% {\r\nopacity: .6\r\n}\r\n}\r\n@keyframes pulse {\r\n30% {\r\nopacity: 1\r\n}\r\n60% {\r\nopacity: 0\r\n}\r\n100% {\r\nopacity: 1\r\n}\r\n}\r\n#progress.waiting dd,#progress.waiting dt {\r\n-moz-animation: pulse 2s ease-out 0s infinite;\r\n-ms-animation: pulse 2s ease-out 0s infinite;\r\n-o-animation: pulse 2s ease-out 0s infinite;\r\n-webkit-animation: pulse 2s ease-out 0s infinite;\r\nanimation: pulse 2s ease-out 0s infinite\r\n}\r\n<\/code><\/pre>\n<h2>#02 JavaScript Code<\/h2>\n<pre><code class=\"js\">\r\n&lt;script src=\"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.9.1\/jquery.min.js\"&gt;&lt;\/script&gt;\r\n$( document ).ready(function() {\r\n$({property: 0}).animate({property: 105}, {\r\nduration: 4000,\r\nstep: function() {\r\nvar _percent = Math.round(this.property);\r\n$('#progress').css('width', _percent+\"%\");\r\nif(_percent == 105) {\r\n$(\"#progress\").addClass(\"done\");\r\n}\r\n},\r\ncomplete: function() {\r\n}\r\n});\r\n});\r\n<\/code><\/pre>\n<h2>#03 HTML Code<\/h2>\n<pre><code class=\"html\">\r\n&lt;div id=\"progress\" class=\"waiting\"&gt;\r\n&lt;dt&gt;&lt;\/dt&gt;\r\n&lt;dd&gt;&lt;\/dd&gt;\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<p>We have already tested this code in our website <a href=\"http:\/\/veewom.com\/linux-programming\/\" target=\"_blank\" rel=\"noopener noreferrer\">See Live Demo<\/a>,if any problems and not working this code please write your problems in comment box below.<\/p>\n<h2>Conclusion<\/h2>\n<p>We hope this article helped you to\u00a0 <strong>How To Add a YouTube Like Loading Bar to Your Website<\/strong>. You may also want to see \u2013 <a href=\"https:\/\/veewom.com\/articles\/best-cloud-hosting-providers.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Best Cloud Hosting Providers<\/a>.<\/p>\n<p>If you liked this article, then please share to social networking site. You can also find us on <a href=\"https:\/\/twitter.com\/veewom\" target=\"_blank\" rel=\"noopener noreferrer\">Twitter<\/a>,<a href=\"https:\/\/www.facebook.com\/veewom\" target=\"_blank\" rel=\"noopener noreferrer\">Facebook<\/a> and <a href=\"https:\/\/www.instagram.com\/veewom\" target=\"_blank\" rel=\"noopener noreferrer\">Instagram<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone, in this article we are going to show you, how to add a youtube type loading bar to your website using css,HTML and javascript code, so here is very simple to add youtube type loading bar, you can use simple css and javascript code you existing website , so no more discussion and &hellip; <a href=\"https:\/\/veewom.com\/articles\/how-to-add-youtube-like-loading-bar-to-website-using-html-css-javascript.htm\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How To Add a YouTube Like Loading Bar to Your Website Using HTML,CSS and JavaScript?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":11101,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[224],"class_list":["post-494","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-css-and-javascript"],"featured_image_src":"https:\/\/veewom.com\/articles\/wp-content\/uploads\/2017\/02\/lo.png","author_info":{"display_name":"Editorial Staff","author_link":"https:\/\/veewom.com\/articles\/author\/admin"},"_links":{"self":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts\/494","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/comments?post=494"}],"version-history":[{"count":1,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts\/494\/revisions"}],"predecessor-version":[{"id":12619,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/posts\/494\/revisions\/12619"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/media\/11101"}],"wp:attachment":[{"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/media?parent=494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/categories?post=494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/veewom.com\/articles\/wp-json\/wp\/v2\/tags?post=494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}