Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
Click to change skin
0%
Loading...
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } 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; }
console.log("Event Fired") /* 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() { $('
').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); }