Subscribe on YouTube

Check out our videos on branding, web design, SEO, and online business.

How to Add Timestamps To Embedded YouTube Videos

Home WordPress How to Add Timestamps To Embedded YouTube Videos

In this video I will show you How to Add Timestamps To Embedded YouTube Videos.

The great thing about this code is you can use it on any type of website, so this isn’t just limited to WordPress websites. You can use this code anywhere you can enable Javascript on the page.

Elementor (Affiliate Link):
https://elementor.com/?ref=4776

YouTube Javascript Code

				
					<div class="responsive-container"><div id="player"></div></div> <script>var tag = document.createElement('script');
      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
      var player;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          videoId: 'S4cZjaXmuzE',
        });
      }
      function setCurrentTime(slideNum) {
        var object = [ 0, 133, 193 ];
        player.seekTo(object[slideNum]);
      }</script> 
				
			

HTML Code

				
					<strong>Timestamps:</strong>
<ul>
 	<li><a href="javascript:void(0);" onclick="setCurrentTime(0)">0:00 Intro</a></li>
 	<li><a href="javascript:void(0);" onclick="setCurrentTime(1)">2:13 1 Minute Challenge</a></li>
 	<li><a href="javascript:void(0);" onclick="setCurrentTime(2)">3:13 Website Speed Results</a></li>
</ul>
<input type="button" value="1 minute challenge" onclick="setCurrentTime(2)" />
				
			

CSS Code

				
					.responsive-container {
	position: relative;
	padding-bottom: 56.25%; /* 16:9 */
	padding-top: 0px;
	height: 0;
	overflow: hidden;
}

.responsive-container iframe,
.responsive-container object,
.responsive-container embed,
.responsive-container video
{
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}
				
			

* Some of the links on this page are affiliate links, meaning we may receive a commission if you follow them. This allows us to continue providing free content and educational resources for you. Thank you for supporting our small business!

More Free Resources

Template Restyles

Get a new website in only 7 days with our new template restyle service. The perfect solution for a new business owner.