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

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <html>
  <meta name="SamualLi" content="lisamual.wordpress.com">
  <body>
  <!--Title Bar-->
      <div class="horizontalLine top"/></div>
      <div class="title">Responsive Photogallery</div>
      <div class="horizontalLine bottom"></div>
        <div class="subtitle">Queen Street - Toronto</div>
     <!--Wrapper-->
 
            <div id="content" class="cf center">
              <!--This is where JS ouputs into the HTML--> 

       
          </div>
  
        <div class="credits">Mouse over for description.<br><a href="http://lisamuel.wordpress.com/code/photo-gallery-template-htmlcssjs/" target = "_blank">The Thought Process!</a><br>Samuel Li</div>


  </body>

  
</html>
            
          
!
            
              /*Samuel Li
Photo Template Design (CSS)

References: 
https://codepen.io/OddlyTimbot/
https://codepen.io/cheeriottis/pen/inluv 
*/

@import url('https://fonts.googleapis.com/css?family=Oswald:400,300,700');

/*===Color Scheme====
Using SCSS For easier swapping of colors
*/
$primaryColor:#954C65;
$secondaryColor:#3D5665;
$tertiaryColor:#686056;
$fourthColor:#53C4E1;
$fifthColor:#A29E74;

/*==Variables of Grid==*/
//+2 px to account for border size
$boxHeight: 242px;
$boxWidth: 25%;
$boxMargin: 5px;

@media (max-width: 600px) {
  .contentBox{
    width: 50%;
  }
}

 //All this keeps everything lined up
html{
  box-sizing: border-box;
}

*, *:before, *:after{
  box-sizing: inherit;
}
body, html{
  height: 100%;
  margin: 0px;
  background-color:#222222;
}

/* ========Grid Style======================*/
//The design for the grid
.center{
  text-align: center;
}

.content{
  text-align: center;
}
.contentBox{
  font-family: Oswald, sans-serif;
  font-weight: 300;
  background-color:$fourthColor;
  border: 1px solid $fifthColor;
  width: $boxWidth;
  height: $boxHeight;
 
  box-shadow: 5px 5px 20px 2px #111111;
  padding: 0px;
  margin: $boxMargin;
  margin-top: 10px;
  /*Vertical align helps keep the boxes vertically aligned*/
  vertical-align: top;
  display:inline-block;
}

//For the captions over the pictures
.boxCover{
  position: relative;
  top: 60%;
  height: 40%;
  width: 100%; 
  background-color:#fff;
  opacity: 0;
}




/*======Button Functionality Code======*/
.animate{
	transition: all 1s;
	-webkit-transition: all 1s;
}
.contentBox:hover{
  border: 1px solid $fourthColor;
}

//*=====Clearfix Hack=======*///
/*
Clearfix hack curtosy of 
OddlyTimbot (my prof)
codepen.io/team/OddlyTimbot
*/
.cf:before,
.cf:after {
    content: " "; /* 1 */
    display: table; /* 2 */
}

.cf:after {
    clear: both;
}

/* ===========Template Style====================== */
//This is just design for the title, subtitle, and caption styling

.title{
  background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.3)), $primaryColor;
  
  border: 1px solid $fifthColor;
  border-top-style: dotted;
  border-bottom-style: dotted;
  border-left-style: none;
  border-right-style: none;
  
  padding-top: 3px;
  padding-bottom: 3px;
  /*Text Design-----*/
  color: #FFFFFF;
  text-shadow: 
    1px 1px $secondaryColor, 
    2px 2px $secondaryColor, 
    3px 3px $secondaryColor, 
    4px 4px $secondaryColor;
  
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  font-size: 2em;
  letter-spacing: 2px;
}
.subtitle{
  font-family: 'Oswald', sans-serif;
  font-weight: 400;
  font-size: 1.4em;
  color: #fff;
  text-align: center;
  margin: 10px;
}
.caption{
  font-family: 'Oswald', sans-serif;
  font-weight: 300;
  font-size: 1.1em;
  color: black;
  text-align: left;
  padding: 5px;
}
.horizontalLine{
  background-color: $secondaryColor;
  padding-bottom:1px;
  padding-top:1px;
  padding: 1px;
}
.top{
  margin-top:15px;
}
.bottom{
  margin-bottom:3px;
}
.credits{
  position:relative;
   font-family: 'Oswald', sans-serif;
  font-weight: 300;
  font-size: 0.9em;
  color: #999999;
  text-align: right;
  letter-spacing: 1px;
}

            
          
!
            
              /*Samuel Li
Photo Template Design

Takes JSON objects with Image URL, titles, and descriptions and outputs them in a photo gallery format */

/*Ensures everything shows up only when the document is loaded*/
$(document).ready(function(){
  
/*=====DUMMY JSON ARRAY======*/
  
  //Object Array
  var dummy = {
    "images": [
      // These are JSON objects can be loaded with AJAX call
      // Object 1 - '{}' seperate objects
      {
        "title": "Active Surplus",
        "description": "Bought a New Geo - why??",
        "img_url": "https://farm8.staticflickr.com/7491/15643889496_1fb839729b.jpg", 
        "url": "https://www.flickr.com/photos/128274399@N07/"
      },
      // Object 2
      {
        "title": "Umbra Store Front",
        "description": "UMBRA - YES Canadian designers!",
        //Replace URL with your own source file
        "img_url": "https://farm4.staticflickr.com/3936/15481655047_8fcaf90f2e.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/"
      },
      // Object 3
      {
        "title": "Ghandis",
        "description": "Go back for Butter Chicken!!",
        //Replace URL with your own source file
        "img_url": "https://farm6.staticflickr.com/5614/15667628115_45a879fb82.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/"
      },
      //Object 4
      {
        "title": "Black Market Clothing",
        "description": "Vintage T shirts, biker jackets",
        //Replace URL with your own source file
        "img_url": "https://farm6.staticflickr.com/5611/15046880434_d8a3981dd1.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      //Object 5
      {
        "title": "Graffiti on Queen St.",
        "description": "Cool graffiti in the heart on Toronto!",
        //Replace URL with your own source file
        "img_url": "https://farm6.staticflickr.com/5610/15047481463_cb5f7c6d28.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      {
        "title": "Statue Near St. Andrew",
        "description": "Who would've known metal can be so cool?",
        //Replace URL with your own source file
        "img_url": "https://farm6.staticflickr.com/5601/15048772403_1a7dd6c208.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      {
        "title": "Black Bull Patio",
        "description": "Sometimes we just need to kick it and relax",
        "img_url": "https://farm9.staticflickr.com/8629/15326129214_9baec740bb_n.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      {
        "title": "Black Bull Signage",
        "description": "Gorgeous Black Lettering and styling on the top of the sign.",
        "img_url": "https://farm8.staticflickr.com/7510/15946443811_a5fcb82e0b_n.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      {
        "title": "Shopping at Active Surplus",
        "description": "Matt getting the tactile feel of em' old modems",
        "img_url": "https://farm8.staticflickr.com/7495/15948406325_025e991c27_n.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      {
        "title": "Exploring Yorkdale Subway Station",
        "description": "Flashing the transfers at Yorkdale",
        "img_url": "https://farm9.staticflickr.com/8598/15760989838_ca2cbc1538_n.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      {
        "title": "Doing Business with Active Surplus",
        "description": "Pete took one for the team to complete our assignment",
        "img_url": "https://farm9.staticflickr.com/8642/15948409085_334cb7263a_n.jpg ",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
       {
        "title": "Shopfronts on Queen St.",
        "description": "Candid shot of Matt mwahaha",
        "img_url": "https://farm9.staticflickr.com/8573/15948409995_a20a0cdd33_n.jpg",
        "url": "https://www.flickr.com/photos/128274399@N07/" 
      },
      
    ]
  }
/*============================*/
  
  //Width and Height resized within img tag
  //Using Underscore JS plugin to grab the variables in the JSON objects and put them right in the HTML code
  var compiled = _.template('<div class="contentBox" style="background-image: url(<%= img_url %>); background-size: cover;"><div class="boxCover caption"><a href="<%= url %>" target = "_blank"><%= title %></a><br><%= description %></div></div>')
  
  
  //Takes the Object Array and writes it into the HTML under the content tag
  for(var i=0; i<dummy.images.length; i++){
    var text = compiled(dummy.images[i]);
    $("#content").append(text);
  }
  
  
  //Javascript Hover

$('.contentBox').hover(function(){
  $(this).find('.boxCover').fadeTo("slow", 0.8, function(){
  
  });  
}, function(){
  $(this).find('.boxCover').fadeTo("fast", 0, function(){
    //After complete
  });  
  
});
  
  
  
  
});



            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console