cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="head">
  <body bgcolor="#1b1b1b">
  <h2></h2>
  
</div>
<div id="tiles"></div>
            
          
!
            
              body {
  @import url('https://fonts.googleapis.com/css?family=Open+Sans');
  font-family: 'Open Sans', sans-serif;
}

h1 {
  font-size: 3.0vw;
  
}

.head {
  width:100%;  
}

.tile {
  float:left;
  max-width:20%;
  min-width:150px;
  text-align:center;
  color: White;
  background-color:#1b1b1b;
  padding-top: 20px;
  position:relative;
}

#tiles img {
  width: 100%;
  z-index:-1;
}

.tile-title {
  font-size: 2.0vw;
 
}

.cover {
  background: #1b1b1b;
  height:7%;
  position: absolute;
  top:94%;
  width:100%;
/*   border: 1px black solid; */
}
            
          
!
            
              // get states
var states = [
'Alabama',
'Alaska',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut',
'Delaware',
'Florida',
'Georgia',
'Hawaii',
'Idaho',
'Illinois',
'Indiana',
'Iowa',
'Kansas',
'Kentucky',
'Louisiana',
'Maine',
'Maryland',
'Massachusetts',
'Michigan',
'Minnesota',
'Mississippi',
'Missouri',
'Montana',
'Nebraska',
'Nevada',
'New Hampshire',
'New Jersey',
'New Mexico',
'New York',
'North Carolina',
'North Dakota',
'Ohio',
'Oklahoma',
'Oregon',
'Pennsylvania',
'Rhode Island',
'South Carolina',
'South Dakota',
'Tennessee',
'Texas',
'Utah',
'Vermont',
'Virginia',
'Washington',
'West Virginia',
'Wisconsin',
'Wyoming'
];
//sort array
sortedStates = states.sort();

function loadImages(list) {
    // loop through states and generate image for each one
    for (i = 0; i < sortedStates.length; i++) { 
      //parse the array of states and assign the current state
      var state = sortedStates[i];
      //get the url of our viz with the state filter added
      var url ="https://public.tableau.com/views/TheHighestandLowestUnemploymentRateSince1990/Timeline?:showVizHome=no&:embed=No&:toolbar=no&:format=png&State="+state;

       //add some HTML to load the image into our "tiles" container
      $("#tiles").append("<div class='tile' style='opacity:0;' id='tile-"+i+"'><span class='tile-title'>"+state+"</span><img src='"+url+"'><div class='cover'></div></div>");

    };
  
  //do something once the images are loaded
  $('#tiles').imagesLoaded()    
  
    //when the loading is complete do this
    .done( function() {

      //set the "opactity" to 1 which makes the tile visible
      $(".tile").each(function() {
        $(this).fadeTo("slow",1);
      });
    })
}


//run this baby
loadImages(sortedStates);
            
          
!
999px
Loading ..................

Console