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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div id="main-container" class="container">
    <!-- TITLE BLOCK -->
    <div class="row">
      <h1 class="center">Flickr Search</h1>
    <!-- SEARCH BLOCK -->
    <div class="row">
      <div class="one-half column offset-by-three">
        <input type="text" v-model="query" debounce="500" class="u-full-width" placeholder="Enter your search string..." />
    <!-- RESULTS BLOCK -->
    <div class="row">
      <div id="no-results" v-show="images.length < 1"><p class="center">Your results will appear here</p></div>
      <div id="loading"></div>
      <div id="search-results">
          <div class="flickr-image" v-for="image in images">
            <div class="thumbnail">
              <a :href="image.link" target="_blank">
                <img src="http://www.arabianbusiness.com/skins/ab.main/gfx/loading_spinner.gif" style="width: 100%;" v-img="image.media.m">
            <div class="author">
              <a :href="image.link" target="_blank">{{ image.author }}</a>
            <div class="tags" v-if="image.tags">
              <div class="tag" v-for="tag in filters.splitTags(image.tags)">{{ tag }}</div>
    <!-- END OF PAGE -->
              /* variables */
@text-color: #222222;
@link-color: #128fdc;
@tag-color: #128fdc;

/* styles */
.author {
  line-height: 2rem;
  margin-bottom: 1.5rem;
  a {
    color: @text-color;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-decoration: none;
    font-weight: bold;
    &:hover {
      color: @link-color;

.tag {
  float: left;
  margin: 2px;
  color: @tag-color;
  border: 1px solid @tag-color;
  padding: 0.15rem 0.3rem;
  border-radius: 5px;
  &:hover {
    background-color: @tag-color;
    color: white;

#search-results {
  -moz-column-width: 13em;
  -webkit-column-width: 13em;
  column-width: 13em;
  -moz-column-gap: 1em;
  -webkit-column-gap: 1em;
  column-gap: 1em;
  .flickr-image {
    display: inline-block;
    margin:  0.25rem;
    padding:  1rem;
    width:  100%;
    background:  #efefef;

/* utilities */
.center {
  text-align: center;

*, *:before, *:after {
  box-sizing:  border-box !important;
              var callApiTimeout = null;

/* VUE.JS logic */
var vm = new Vue({
  el: '#main-container',
  data: {
    images: [],
    query: ''
  watch: {
    query: function (value) {
      callApiTimeout = setTimeout(function () {
        var reqURL = "https://api.flickr.com/services/feeds/photos_public.gne";
        var options = {
          params: {
            format: 'json',
            tags: this.query

        this.$http.jsonp(reqURL, options);
      }.bind(this), 250);

/* JSONP callback function */
function jsonFlickrFeed(response) {
  vm.$data.images = response.items;

/* VueJs utilites */
Vue.directive('img', {
  inserted: function (el, binding) {
    lazyload(el, binding);
  update: function (el, binding) {
    lazyload(el, binding);

Vue.prototype.filters = {
  splitTags: function (value) {
    // showing only first 5 tags
    return value.split(' ').slice(0,5);

/* General utility functions */
function lazyload(el, binding) {
  var img = new Image();
  img.src = binding.value;

  img.onload = function() {
    el.src = binding.value;
🕑 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.