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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <!-- PRELOADER IS LOADING ACTUAL IMAGES TO SHOW FUNCTIONALITY. BROWSER CACHES IMAGES AFTER FIRST LOAD SO SUBSEQUENT LOADS WILL BE FASTER. -->

<!-- RELOAD PEN OR CLICK A COLOR THUMBNAIL TO CHANGE THE SKIN -->

<!-- skins -->
<div class="skins">
		Click to change skin
		<div class="skin" id="red"></div>
		<div class="skin" id="blue"></div>
		<div class="skin" id="green"></div>
		<div class="skin" id="yellow"></div>
		<div class="skin" id="purple"></div>
		<div class="skin" id="gray"></div>
	</div>

<!-- actual preloader -->
	<div class="loader">
		<div class="progress-bar"><div class="progress-stripes"></div><div class="percentage">0%</div></div>
	</div>

	<span>Loading...</span>
              
            
!

CSS

              
                body{
  background: #e7e7e7;
  font-family: Arial, Helvetica, Sans-serif;
  text-align: center;
  padding: 5px;
  margin: 0;
}

.loader{
  margin: 50px auto 10px;
  width: 300px;
  height: 25px;
  border-radius: 14px;
  border-bottom: 1px solid #fff;
  border-top: 1px solid #999;
  background: #ccc;
  overflow: hidden;
  position: relative;
}

.loader.gray{
  background: #999;
}

.progress-bar{
  height: inherit;
  width: 0%;
  border-radius: inherit;
  position: relative;
  overflow: hidden;
}

.progress-stripes{
  width: inherit;
  height: inherit;
  font-size: 180px;
  font-weight: bold;
  margin-top: -50px;
  letter-spacing: -14px;
}

.percentage{
  position: absolute;
  top: 4px;
  right: 5px;
  font-weight: bold;
  font-size: 16px;
}



/***************************************/
/* BELOW HERE IS SOLELY FOR AESTHETICS */
/*_____________________________________*/

/*** COLOR SCHEMES ***/

/* RED */
.red .progress-bar{
  background: #e74c3c;
}
.red .progress-stripes{
  color: #c0392b;
}
.red .percentage{
  color: #eee;
}

/* BLUE */
.blue .progress-bar{
  background: #3498db;
}
.blue .progress-stripes{
  color: #2980b9;
}
.blue .percentage{
  color: #eee;
}

/* GREEN */
.green .progress-bar{
  background: #2ecc71;
}
.green .progress-stripes{
  color: #27ae60;
}
.green .percentage{
  color: #fff;
}

/* YELLOW */
.yellow .progress-bar{
  background: #f1c40f;
}
.yellow .progress-stripes{
  color: #f39c12;
}
.yellow .percentage{
  color: #fff;
}

/* PURPLE */
.purple .progress-bar{
  background: #9b59b6;
}
.purple .progress-stripes{
  color: #8e44ad;
}
.purple .percentage{
  color: #eee;
}

/* GRAY */
.gray .progress-bar{
  background: #ecf0f1;
}
.gray .progress-stripes{
  color: #bdc3c7;
}
.gray .percentage{
  color: #333;
}

/*** LOADED ***/

span{
  color: #888;
  text-shadow: 0 1px 0 #fff;
}

span.loaded.red{
  color: #c0392b;
}

span.loaded.blue{
  color: #2980b9;
}

span.loaded.green{
  color: #27ae60;
}

span.loaded.yellow{
  color: #d35400;
}

span.loaded.purple{
  color: #8e44ad;
}

span.loaded.gray{
  color: #444;
}

/*** SKINS ***/
.skins{
  padding: 4px 0 8px;
  cursor: default;
  font-size: 14px;
  color: #666;
  background: #fff;
  opacity: .5;
  -moz-transition: opacity .25s linear;
  -webkit-transition: opacity .25s linear;
  transition: opacity .25s linear;
}

.skins:hover{
  opacity: 1;
}

.skin{
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-bottom: -7px;
  border: 1px solid #fff;
  display: inline-block;
    *display: inline;
    zoom: 1.0;
}
#red{
  background: #c0392b;
}
#red:hover{
  background: #e74c3c;
}
#blue{
  background: #2980b9;
}
#blue:hover{
  background: #3498db;
}
#green{
  background: #27ae60;
}
#green:hover{
  background: #2ecc71;
}
#yellow{
  background: #f39c12;
}
#yellow:hover{
  background: #f1c40f;
}
#purple{
  background: #8e44ad;
}
#purple:hover{
  background: #9b59b6;
}
#gray{
  background: #7f8c8d;
}
#gray:hover{
  background: #95a5a6;
}
              
            
!

JS

              
                /* SET RANDOM LOADER COLORS FOR DEMO PURPOSES */	
	var demoColorArray = ['red','blue','green','yellow','purple','gray'];
	var colorIndex = Math.floor(Math.random()*demoColorArray.length);
	setSkin(demoColorArray[colorIndex]);
	

	/* RANDOM LARGE IMAGES FOR DEMO PURPOSES */	
	var demoImgArray = ['http://www.hdwallpapers.in/walls/halloween_2013-wide.jpg', 'http://www.hdwallpapers.in/walls/2013_print_tech_lamborghini_aventador-wide.jpg', 'http://www.hdwallpapers.in/walls/ama_dablam_himalaya_mountains-wide.jpg', 'http://www.hdwallpapers.in/walls/arrow_tv_series-wide.jpg', 'http://www.hdwallpapers.in/walls/anna_in_frozen-wide.jpg', 'http://www.hdwallpapers.in/walls/frozen_elsa-wide.jpg', 'http://www.hdwallpapers.in/walls/shraddha_kapoor-wide.jpg', 'http://www.hdwallpapers.in/walls/sahara_force_india_f1_team-HD.jpg', 'http://www.hdwallpapers.in/walls/lake_sunset-wide.jpg', 'http://www.hdwallpapers.in/walls/2013_movie_cloudy_with_a_chance_of_meatballs_2-wide.jpg', 'http://www.hdwallpapers.in/walls/bates_motel_2013_tv_series-wide.jpg', 'http://www.hdwallpapers.in/walls/krrish_3_movie-wide.jpg', 'http://www.hdwallpapers.in/walls/universe_door-wide.jpg', 'http://www.hdwallpapers.in/walls/night_rider-HD.jpg', 'http://www.hdwallpapers.in/walls/tide_and_waves-wide.jpg', 'http://www.hdwallpapers.in/walls/2014_lamborghini_veneno_roadster-wide.jpg', 'http://www.hdwallpapers.in/walls/peeta_katniss_the_hunger_games_catching_fire-wide.jpg', 'http://www.hdwallpapers.in/walls/captain_america_the_winter_soldier-wide.jpg', 'http://www.hdwallpapers.in/walls/puppeteer_ps3_game-wide.jpg', 'http://www.hdwallpapers.in/walls/lunar_space_galaxy-HD.jpg', 'http://www.hdwallpapers.in/walls/2013_wheelsandmore_lamborghini_aventador-wide.jpg', 'http://www.hdwallpapers.in/walls/destiny_2014_game-wide.jpg', 'http://www.hdwallpapers.in/colors_of_nature-wallpapers.html', 'http://www.hdwallpapers.in/walls/sunset_at_laguna_beach-wide.jpg'];
	
	// Stripes interval
	var stripesAnim;
	var calcPercent;
	
	$progress = $('.progress-bar');
	$percent = $('.percentage');
	$stripes = $('.progress-stripes');
	$stripes.text('////////////////////////');
	
	/* CHANGE LOADER SKIN */
	$('.skin').click(function(){
		var whichColor = $(this).attr('id');
		setSkin(whichColor);
	});
	
	// Call function to load array of images
	preload(demoImgArray);
	
	// Call function to animate stripes
	stripesAnimate(); 
	
	/* WHEN LOADED */
	$(window).load(function() {
		loaded = true;
		$progress.animate({
			width: "100%"
		}, 100, function() {
			$('span').text('Loaded!').addClass('loaded');
			$percent.text('100%');
			clearInterval(calcPercent);
			clearInterval(stripesAnim);
		});
	});
	
	/*** FUNCTIONS ***/
	
	/* LOADING */
	function preload(imgArray) {
		var increment = Math.floor(100 / imgArray.length);
		$(imgArray).each(function() {
			$('<img>').attr("src", this).load(function() {
				$progress.animate({
					width: "+=" + increment + "%"
				}, 100);
			});
		});
		calcPercent = setInterval(function() {
			
			//loop through the items
			$percent.text(Math.floor(($progress.width() / $('.loader').width()) * 100) + '%');
			
		});
	}
	
	/* STRIPES ANIMATION */
	function stripesAnimate() {
		animating();
		stripesAnim = setInterval(animating, 2500);
	}

	function animating() {
		$stripes.animate({
			marginLeft: "-=30px"
		}, 2500, "linear").append('/');
	} 
	
	function setSkin(skin){
		$('.loader').attr('class', 'loader '+skin);
		$('span').hasClass('loaded') ? $('span').attr('class', 'loaded '+skin) : $('span').attr('class', skin);
	}
              
            
!
999px

Console