HTML5のビデオのプログレスをカスタマイズする

参考にしたサイト

まずはコードから

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="style.css" type="text/css" />
        <script src="video.js">
    </head>
    <body>
            <video id="vid" src="video.mp4"></video>
            <div id="progress">
                <div id="out">
                    <div id="inner"></div>
                </div>
            </div>
    </body>
</html>

このようにHTMLを作成します

次にスクリプト

function main() {
    const video = document.getElementById('vid');
 

 
 
    // プログレスバー長さ更新
    const progressOut = document.getElementById("out");
    const progressIn = document.getElementById("inner");
    video.addEventListener('timeupdate', function() {
        progressIn.style.transform = "scaleX("+(video.currentTime / video.duration)+")";
    });
 
 
    // プログレスバークリック時イベント
    progressOut.addEventListener('click', function(e)  {
        const percent = (e.pageX - (progressOut.getBoundingClientRect().left + window.pageXOffset)) / progressOut.clientWidth;
        video.currentTime = video.duration * percent;
    });
};
 
 
 
document.addEventListener('DOMContentLoaded',function () {
    main();
});

このコードは参考にしたサイトから一部を変更し抜粋しました.

このコードは古いIEでも動作します

下は一部変更のうえ抜粋しました

#progress-wrap {
    width: 100%;
    height: 1rem;
}
 
#progress-out {
    width: 100%;
    height: 100%;
    background-color: #33ffcc;
    border-radius: 3px;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    transform: scaleY(0.5);
    transition: 0.3s;
}
#progress-out:hover {
    transform: scaleY(1.0);
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}
 
#progress-in {
    margin: 0 auto 0 0;
    width: 100%;
    height: 100%;
    background-color: #3F51B5;
    border-radius: 3px;
    transform-origin: top left;
    transition: 0.1s;
}

“HTML5のビデオのプログレスをカスタマイズする”へのコメント156

  1. d4e セックスストーリーでセックスを助け、セックスの喜びを体験してくださいアメリカではダッチワイフを合法で保護されていますか?若い女性が太りすぎになる傾向は何ですか?本物のダッチワイフ–さまざまな顕著な特徴を好む

  2. There are actually loads of particulars like that to take into consideration. That could be a great level to deliver up. I supply the thoughts above as normal inspiration but clearly there are questions like the one you carry up the place an important factor shall be working in sincere good faith. I don?t know if best practices have emerged round issues like that, but I am positive that your job is clearly recognized as a fair game. Both boys and girls feel the influence of just a moment抯 pleasure, for the rest of their lives.

  3. I抎 have to test with you here. Which isn’t one thing I usually do! I enjoy reading a post that will make people think. Additionally, thanks for permitting me to comment!

  4. After examine a few of the weblog posts on your web site now, and I actually like your way of blogging. I bookmarked it to my bookmark web site record and shall be checking again soon. Pls try my web page as properly and let me know what you think.

  5. Oh my goodness! an amazing article dude. Thank you However I’m experiencing problem with ur rss . Don抰 know why Unable to subscribe to it. Is there anyone getting an identical rss problem? Anybody who knows kindly respond. Thnkx

  6. Oh my goodness! an amazing article dude. Thanks However I am experiencing concern with ur rss . Don抰 know why Unable to subscribe to it. Is there anybody getting equivalent rss problem? Anyone who knows kindly respond. Thnkx

  7. After research just a few of the weblog posts on your web site now, and I actually like your method of blogging. I bookmarked it to my bookmark website record and will probably be checking back soon. Pls take a look at my web page as well and let me know what you think.

  8. Can I just say what a reduction to find someone who truly knows what theyre talking about on the internet. You positively know the right way to carry a difficulty to mild and make it important. Extra folks must learn this and perceive this aspect of the story. I cant consider youre no more popular because you definitely have the gift.

  9. Oh my goodness! an incredible article dude. Thank you Nonetheless I’m experiencing difficulty with ur rss . Don抰 know why Unable to subscribe to it. Is there anybody getting equivalent rss downside? Anybody who is aware of kindly respond. Thnkx

  10. I was very happy to search out this internet-site.I wanted to thanks for your time for this excellent learn!! I definitely enjoying each little little bit of it and I have you bookmarked to check out new stuff you weblog post.

  11. An impressive share, I just given this onto a colleague who was doing a little analysis on this. And he actually bought me breakfast as a result of I found it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love studying more on this topic. If doable, as you turn into expertise, would you thoughts updating your blog with more details? It is extremely useful for me. Big thumb up for this weblog put up!

  12. Youre so cool! I dont suppose Ive read anything like this before. So nice to search out someone with some original thoughts on this subject. realy thank you for starting this up. this web site is one thing that’s needed on the internet, somebody with slightly originality. helpful job for bringing one thing new to the internet!

  13. There are some fascinating time limits on this article however I don抰 know if I see all of them center to heart. There’s some validity but I’ll take maintain opinion till I look into it further. Good article , thanks and we wish more! Added to FeedBurner as properly

  14. There are some attention-grabbing closing dates in this article however I don抰 know if I see all of them center to heart. There’s some validity but I will take hold opinion till I look into it further. Good article , thanks and we wish more! Added to FeedBurner as nicely

  15. This web page is known as a stroll-by means of for the entire information you needed about this and didn抰 know who to ask. Glimpse here, and also you抣l definitely discover it.

  16. There are some attention-grabbing closing dates on this article but I don抰 know if I see all of them center to heart. There is some validity but I’ll take hold opinion till I look into it further. Good article , thanks and we would like extra! Added to FeedBurner as effectively

  17. A formidable share, I just given this onto a colleague who was doing just a little evaluation on this. And he in reality bought me breakfast as a result of I discovered it for him.. smile. So let me reword that: Thnx for the deal with! However yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love studying more on this topic. If potential, as you turn into experience, would you thoughts updating your weblog with extra details? It’s highly helpful for me. Massive thumb up for this blog put up!

  18. There are definitely a variety of particulars like that to take into consideration. That may be a nice level to bring up. I offer the ideas above as general inspiration however clearly there are questions like the one you carry up where a very powerful thing will likely be working in honest good faith. I don?t know if greatest practices have emerged around issues like that, however I’m sure that your job is clearly identified as a fair game. Each girls and boys feel the impression of only a moment抯 pleasure, for the remainder of their lives.

  19. Can I simply say what a aid to find somebody who truly knows what theyre talking about on the internet. You undoubtedly know learn how to bring an issue to light and make it important. Extra people need to read this and perceive this side of the story. I cant consider youre not more in style because you definitely have the gift.

  20. There are actually a number of details like that to take into consideration. That could be a nice level to deliver up. I offer the ideas above as basic inspiration however clearly there are questions just like the one you carry up the place an important factor will likely be working in sincere good faith. I don?t know if greatest practices have emerged round issues like that, but I’m certain that your job is clearly recognized as a good game. Both boys and girls really feel the impression of only a second抯 pleasure, for the remainder of their lives.

  21. Youre so cool! I dont suppose Ive read something like this before. So nice to seek out any person with some unique thoughts on this subject. realy thank you for starting this up. this web site is something that is wanted on the web, somebody with a bit of originality. useful job for bringing one thing new to the web!

  22. Thanks for each of your work on this web page. My daughter delights in going through research and it’s really easy to see why. My partner and i hear all regarding the dynamic manner you offer very useful guidelines through the web blog and in addition attract participation from website visitors on the concern while my daughter is becoming educated a great deal. Have fun with the remaining portion of the year. You’re the one carrying out a first class job.

  23. I have to get across my appreciation for your kind-heartedness giving support to people that really need assistance with that matter. Your special dedication to getting the message throughout turned out to be amazingly good and have consistently encouraged guys like me to realize their goals. Your interesting publication indicates a lot a person like me and far more to my mates. Warm regards; from all of us.

  24. I wanted to make a comment in order to thank you for some of the amazing guides you are sharing at this website. My long internet research has at the end been rewarded with useful tips to talk about with my two friends. I would point out that many of us visitors are really lucky to live in a really good website with very many wonderful individuals with great solutions. I feel very much happy to have used your webpage and look forward to tons of more thrilling times reading here. Thank you again for everything.

  25. I wish to convey my affection for your kindness in support of persons who really need help with that area. Your personal commitment to passing the message all-around ended up being incredibly helpful and have in every case helped professionals like me to reach their goals. This warm and helpful help and advice signifies a whole lot a person like me and still more to my peers. With thanks; from everyone of us.

  26. I want to express some appreciation to the writer for rescuing me from such a issue. Because of exploring through the search engines and obtaining thoughts that were not powerful, I thought my life was well over. Being alive without the strategies to the problems you’ve fixed by means of your entire post is a serious case, as well as the kind that might have badly damaged my career if I had not discovered your web page. Your training and kindness in controlling all things was helpful. I’m not sure what I would have done if I hadn’t come across such a subject like this. I’m able to at this moment relish my future. Thanks a lot very much for this professional and result oriented help. I will not think twice to suggest your web blog to anyone who wants and needs recommendations about this subject.

  27. Thanks so much for giving everyone such a superb opportunity to read critical reviews from here. It’s usually so lovely and also packed with a great time for me personally and my office mates to search your site particularly 3 times in one week to read through the latest stuff you have got. Not to mention, I am just certainly motivated with your great advice you give. Certain 4 facts in this article are honestly the most effective we’ve ever had.

  28. I truly wanted to write down a brief word to say thanks to you for all of the fabulous techniques you are sharing on this website. My extensive internet search has at the end been compensated with reasonable suggestions to exchange with my classmates and friends. I would believe that we website visitors are unquestionably lucky to exist in a useful network with many special individuals with insightful opinions. I feel somewhat fortunate to have discovered your web pages and look forward to many more enjoyable times reading here. Thanks a lot again for a lot of things.

  29. Thank you so much for providing individuals with such a breathtaking possiblity to read articles and blog posts from here. It really is very nice and as well , stuffed with a lot of fun for me and my office friends to visit your website on the least thrice per week to see the newest things you have. And lastly, I’m just usually astounded concerning the good guidelines you serve. Selected 3 tips in this post are without a doubt the most impressive I have ever had.

  30. I wish to show some appreciation to the writer for bailing me out of this particular issue. Because of searching through the search engines and coming across ideas which were not pleasant, I thought my entire life was well over. Existing without the presence of solutions to the problems you have fixed all through your good report is a serious case, as well as the ones which could have negatively affected my career if I hadn’t encountered the website. Your own know-how and kindness in handling everything was very useful. I am not sure what I would’ve done if I hadn’t encountered such a stuff like this. It’s possible to at this time look forward to my future. Thanks a lot so much for this skilled and result oriented guide. I will not be reluctant to suggest the sites to any individual who requires direction on this problem.

  31. My spouse and i have been quite fulfilled Albert managed to deal with his studies through your ideas he acquired using your web site. It’s not at all simplistic to just continually be giving for free points that many a number of people may have been making money from. We really consider we have the website owner to thank for that. All of the illustrations you’ve made, the easy website menu, the friendships your site make it possible to promote – it’s most amazing, and it is letting our son and the family understand the subject is pleasurable, and that’s truly essential. Thanks for all!

  32. I must voice my gratitude for your kind-heartedness for individuals who really want help with this one concern. Your real dedication to getting the solution around appears to be extraordinarily productive and have continuously made guys and women like me to realize their targets. Your amazing valuable advice denotes a whole lot to me and further more to my office workers. With thanks; from all of us.

  33. I needed to draft you the very little remark to be able to say thank you yet again for all the precious opinions you have documented here. It is simply strangely generous with you to deliver extensively precisely what a number of us would’ve offered as an electronic book in making some cash for their own end, and in particular considering that you might well have tried it in the event you decided. Those solutions also acted to become easy way to realize that many people have the identical zeal much like my own to know great deal more when considering this matter. I’m certain there are several more pleasant sessions in the future for people who go through your blog post.

  34. I intended to post you this bit of observation to thank you yet again on your incredible information you have documented on this site. It’s quite surprisingly open-handed of people like you to present openly what many people would’ve marketed as an e book to help with making some money on their own, precisely considering the fact that you could have done it in case you considered necessary. These strategies likewise acted to become good way to comprehend other people online have the same eagerness really like my very own to realize much more in terms of this problem. I am certain there are thousands of more enjoyable sessions up front for those who check out your blog post.

  35. My spouse and i got really joyful that Ervin managed to deal with his inquiry using the ideas he had using your web site. It’s not at all simplistic to simply continually be offering tips which usually a number of people may have been trying to sell. And now we see we need you to be grateful to for that. Those illustrations you have made, the easy blog menu, the relationships you assist to foster – it’s got all sensational, and it is aiding our son in addition to our family reckon that that subject is cool, and that’s truly indispensable. Thank you for the whole lot!

  36. I have to express my appreciation to this writer for bailing me out of this particular instance. As a result of surfing throughout the search engines and getting solutions which were not beneficial, I assumed my entire life was gone. Being alive without the answers to the issues you have fixed as a result of this short post is a serious case, as well as the kind that would have adversely damaged my entire career if I had not noticed the website. Your own personal ability and kindness in controlling all the pieces was excellent. I don’t know what I would have done if I hadn’t discovered such a stuff like this. I am able to at this point look forward to my future. Thanks for your time so much for this reliable and results-oriented help. I will not think twice to recommend your site to any person who ought to have counselling about this area.

  37. My spouse and i have been so fulfilled that Emmanuel managed to conclude his investigation out of the ideas he came across in your web pages. It is now and again perplexing to simply happen to be making a gift of tips and tricks which some other people may have been making money from. And now we understand we have got the website owner to thank for this. The entire explanations you’ve made, the straightforward blog navigation, the relationships you help engender – it’s got most sensational, and it’s really facilitating our son in addition to our family consider that that subject matter is exciting, which is certainly rather mandatory. Thank you for all!

  38. I and also my guys have already been following the best techniques on your site while all of the sudden came up with an awful suspicion I never thanked the web blog owner for those strategies. My women were definitely as a result thrilled to read through them and already have really been loving those things. Many thanks for simply being very thoughtful and also for settling on some nice subject matter most people are really eager to be informed on. My very own honest apologies for not saying thanks to sooner.

  39. Thanks a lot for providing individuals with an extremely memorable possiblity to read articles and blog posts from here. It can be so amazing and also stuffed with fun for me personally and my office fellow workers to search your web site nearly three times in one week to read the new tips you will have. And of course, I’m just certainly happy for the cool methods you serve. Selected 2 tips in this article are essentially the most impressive I’ve had.

  40. I am glad for commenting to make you understand of the perfect discovery my daughter enjoyed reading through the blog. She picked up a lot of things, including what it is like to possess a very effective coaching heart to get many people really easily comprehend various complicated things. You really did more than visitors’ expected results. I appreciate you for showing these necessary, safe, revealing and also cool guidance on this topic to Jane.

  41. I have to show some appreciation to you just for rescuing me from this particular circumstance. Right after looking through the internet and seeing principles which were not beneficial, I thought my life was well over. Existing without the presence of answers to the problems you have resolved by way of this article content is a critical case, as well as ones which may have negatively damaged my career if I hadn’t come across your website. Your primary ability and kindness in controlling all the details was tremendous. I don’t know what I would have done if I hadn’t encountered such a point like this. It’s possible to at this point relish my future. Thank you very much for your expert and amazing guide. I will not be reluctant to suggest the sites to anyone who would need support on this subject.

  42. I wanted to type a quick remark to be able to express gratitude to you for the unique guidelines you are sharing at this website. My incredibly long internet research has at the end of the day been paid with high-quality content to share with my neighbours. I ‘d express that most of us visitors actually are very endowed to exist in a useful place with very many lovely people with useful tricks. I feel extremely fortunate to have discovered the webpage and look forward to tons of more entertaining minutes reading here. Thanks a lot once again for all the details.

  43. I am just commenting to make you be aware of what a excellent encounter my cousin’s princess had reading through your web site. She realized several issues, which included what it’s like to have an excellent teaching mood to have folks smoothly gain knowledge of specific complicated matters. You really did more than people’s expected results. I appreciate you for distributing those valuable, trusted, edifying not to mention unique tips about that topic to Ethel.

  44. I want to voice my gratitude for your kindness in support of folks that have the need for assistance with this particular matter. Your real commitment to passing the message throughout appears to be definitely good and has really encouraged associates like me to achieve their dreams. Your own invaluable tips and hints signifies so much a person like me and extremely more to my office workers. Thanks a lot; from all of us.

  45. Thank you a lot for providing individuals with such a spectacular opportunity to read critical reviews from this site. It is usually very pleasing plus full of amusement for me and my office acquaintances to visit the blog at least 3 times a week to see the newest things you have. And indeed, I am usually fascinated with all the beautiful creative ideas served by you. Selected 4 areas in this post are in fact the most suitable I’ve had.

  46. I have to express thanks to this writer just for rescuing me from this dilemma. As a result of exploring throughout the online world and seeing strategies which were not helpful, I assumed my life was well over. Existing devoid of the approaches to the issues you’ve solved as a result of your good report is a crucial case, as well as the ones that would have in a negative way damaged my career if I hadn’t noticed your web blog. Your primary know-how and kindness in handling every aspect was excellent. I don’t know what I would have done if I hadn’t come upon such a subject like this. I am able to at this moment relish my future. Thanks for your time very much for your expert and results-oriented guide. I won’t think twice to suggest your web site to anyone who needs and wants guide on this subject.

  47. I’m just commenting to let you understand what a really good discovery my cousin’s child went through reading your webblog. She figured out a good number of things, including what it is like to have an ideal giving mindset to have many more without difficulty completely grasp specific impossible topics. You truly did more than people’s expected results. Thank you for showing these practical, dependable, revealing and as well as unique tips about this topic to Sandra.

  48. I simply had to thank you very much once again. I do not know what I might have undertaken in the absence of the actual strategies provided by you directly on that situation. It was a very troublesome problem in my circumstances, nevertheless noticing this expert strategy you treated the issue made me to weep over gladness. Extremely happier for your service and thus expect you are aware of an amazing job you are always providing instructing many people with the aid of your web site. More than likely you have never come across all of us.

  49. I am glad for commenting to make you know of the extraordinary encounter my wife’s girl had viewing your web site. She discovered numerous pieces, which include what it’s like to possess a great giving spirit to have many people without difficulty master specific tricky subject matter. You truly surpassed her expected results. Thank you for providing the effective, healthy, revealing as well as unique tips on your topic to Tanya.

  50. I must show some appreciation to this writer for bailing me out of this challenge. As a result of researching throughout the world wide web and obtaining tips that were not productive, I believed my entire life was done. Living without the presence of solutions to the issues you’ve solved all through your main blog post is a critical case, and ones that would have adversely damaged my career if I hadn’t come across the website. Your know-how and kindness in touching the whole lot was tremendous. I’m not sure what I would have done if I had not discovered such a stuff like this. I can also now relish my future. Thanks for your time so much for this expert and effective guide. I won’t think twice to refer your blog post to any individual who should receive recommendations on this situation.

  51. Thank you a lot for giving everyone remarkably remarkable possiblity to read from this web site. It is usually so pleasing and as well , stuffed with a good time for me and my office friends to visit your website a minimum of thrice in one week to read the fresh items you will have. And indeed, I am actually amazed for the very good thoughts you serve. Some 4 points in this article are unquestionably the best we’ve had.

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です