Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                    <div id="preloader">
        <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
              viewBox="0 0 1600 977" enable-background="new 0 0 1600 977" xml:space="preserve">
          <!-- you'll want to change the size of your svg to whatever the size of your content is --> 
			<path fill="none" stroke="#ccc" stroke-width="20" stroke-miterlimit="20" d="M943.224,488.5
				c0,79.101-64.124,143.223-143.224,143.223c-79.1,0-143.224-64.122-143.224-143.223c0-79.1,64.124-143.223,143.224-143.223
				C879.1,345.277,943.224,409.4,943.224,488.5z"/>
			<path id="preloaderStroke" fill="none" stroke="#d87c20" stroke-width="20" stroke-miterlimit="10" d="M943.224,488.5
				c0,79.101-64.124,143.223-143.224,143.223c-79.1,0-143.223-64.122-143.223-143.223c0-79.1,64.123-143.223,143.223-143.223
				C879.1,345.277,943.224,409.4,943.224,488.5z"/>
			<text text-anchor="middle" id="preloaderPercentage" transform="matrix(1 0 0 1 805 512.2549)" fill="#666766" font-family="'Calibri'" font-size="80">0%</text>
	     </svg>
    </div> 

<div id="loadImagesHereWhenLoaded"></div> 
              
            
!

CSS

              
                #preloader{ 
	position:absolute; 
	top:0%; 
	z-index:2;
	width:50%; 
	max-width:50%; 
	height:auto; 
} 

#loadImagesHereWhenLoaded{
 opacity:0; 
}
              
            
!

JS

              
                $(function() {

function imagePreloader(){ 
		var imagePreloader_tl = new TimelineMax({paused:true}); 
		$preloaderContent = $("#preloader")
		$preloader_outline = $("#preloaderStroke")
		$preloaderPercentage = $("#preloaderPercentage") 
		imagePreloader_tl.to($preloaderContent, .15 ,{autoAlpha:1}, "start") 
					           .fromTo($preloader_outline, .5, {drawSVG:"0"}, {drawSVG:"100%"}, "start")
			var urls = [
				'http://placehold.it/350x150',
				'http://placehold.it/350x150',
				'http://placehold.it/350x150', 
				'http://placehold.it/350x150',	
				'http://placehold.it/350x150',	
        //Put the images you want preloaded here.  
			];
			var imgs = [];
			var cnt = 0; 
			
			var $startPercentage = {value:0};
			function updatePercentLoadedText() {
				$preloaderPercentage.text($startPercentage.value+"%" )
			}
			
			for (var i = 0; i < urls.length; i++) {  
				var img = new Image();
				img.onload = function() {
					++cnt;  
					if (cnt >= urls.length) { 
            //The counter stops before it makes it up to 100%, 
            //even when all of the images have been loaded
            //this makes sure the text says "100%" before it fades out 
            //even though you wouldn't even notice unless your Internet connection was very slow. 
						TweenMax.to($startPercentage, .5, {value:100, roundProps:"value", onUpdate:updatePercentLoadedText});
						TweenMax.to($preloaderContent, .75, {autoAlpha:0, scale:0, delay:.25, ease:Back.easeInOut});
						TweenMax.to(imagePreloader_tl, .25, {progress:1});
            //This will  fade in everything only after it's fully loaded 
            TweenMax.to($("#loadImagesHereWhenLoaded"), .25, {autoAlpha:1});
            $('#loadImagesHereWhenLoaded').append("<br>All loaded!");
					} else {
            //You don't need this, it's for the demo only 
            $imgSrc = img.src; 
            $("<img>", { src: $imgSrc }).prependTo("#loadImagesHereWhenLoaded");
            //  
						$imageLoadPercentage = (100*cnt/urls.length)
						$imageLoadPercentageTLprogress = (.01*$imageLoadPercentage)
						TweenMax.to(imagePreloader_tl, .25, {progress:$imageLoadPercentageTLprogress});
            //Might want to increase this if you are loading some massive images, otherwise the percentage increase will stall in-between images 
						TweenMax.to($startPercentage, .5, {value:$imageLoadPercentage, roundProps:"value", onUpdate:updatePercentLoadedText});
					}    
				}; 
				img.src = urls[i]; 
				imgs.push(img); 
			} 
	}
	
	imagePreloader()
  
  });
 
  
              
            
!
999px

Console