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="wrapper row">
		<h1>Flicker Search</h1>
		
		<form id="picturesearch">
		<input type="text" id="picture-input" />
		<button id="picturebtn" role="button" type="button" class="btn btn-large btn-primary">Get Some Images</button>
		</form>
		<div id="images" class="row">
		</div>
	</div>
            
          
!
            
              var row = 0; // global variable
$( '#picturebtn' ).click(function() {
  row++; 
  var cell = 1;
  while (cell < 4) {
    var content = "<div id=\"r" + row + "c" + cell + "\" class=\"col-sm-6 col-md-4\"></div>";
    $( ".row" ).append( content );
    cell++;
  }
  var query = $('#picture-input').val(); // Gets info from text box

  var flickerAPI = "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?";
  $.getJSON( flickerAPI, {
    tags: query,
    tagmode: "any",
    format: "json"
  })
  .done(function( data ) {
    var divAttach = "#r" + row + "cv";
    $.each( data.items, function( i, item ) {
      divAttach = divAttach.substring(0, 4); // remove last character
      divAttach += i; // add i to the end
      // alert( "divAttach is now: " + divAttach );
      $( "<img class='img-result' />" ).attr( "src", item.media.m ).appendTo( divAttach );

      if ( i === 3 ) {
        return false;
      }
    });
  });
})();

            
          
!
999px
Loading ..................

Console