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


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


    	<title>Amazing Image Gallery</title>
        <meta charset="utf8">
        <script src=""></script>
        <h1>Amazing Image Gallery</h1>
            <!-- container for the main photo -->
            <div class="photoFrame">
                <a id="photoLink" target="_blank"><img id="largePhoto"></a>
            <!-- container for the thumbnails -->
            <div id="thumbs">
                        <div class="left-arrow navigation" id="newPhoto" style="float: left;"></div>

                <img id="0">
                <img id="1">
                <img id="2">
                <img id="3"> 
                            <div class="right-arrow navigation" id="oldPhoto" style="float: right;"></div> 

                © Carlos Kynäslahti 2015


                img {
    padding: 0px;
    margin: 0px;
    float: left;

h1 {
    text-align: center; 
    font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;

div.photoFrame {
    margin: 0 auto; 
    height: 600px; 
    width: 600px;

img#largePhoto {
    height: 600px;
    width: 600px;

div#thumbs {
    width: 50%; 
    margin: 0 auto;  
   height: 150px; 
    width: 900px;

div#thumbs img {
    overflow: hidden;

div#imageLoader {
    display: none;

p {
    font-family: 'Helvetica Neue', 'Lucida Grande'; 
    font-size: 11px;


#newPhoto:hover {
    border-color: transparent #545657 transparent transparent;

#oldPhoto:hover {
    border-color: transparent transparent transparent #545657;

.left-arrow {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 75px 150px 75px 0;
    border-color: transparent #c7c7c7 transparent transparent;
    display: inline;

.right-arrow {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 75px 0 75px 150px;
    border-color: transparent transparent transparent #c7c7c7;
    display: inline;


.cf:after {
    clear: both;

.tooltip {
    display: none;
    position: absolute;
    border: 1px solid #333;
    background-color: #161616;
    border-radius: 5px;
    padding: 10px;
    color: #fff;
    font-size: 12px Arial;
    width: 35%;


    // uses to get 4 most recent pictures from Instagram. requires a registered client & permission from user
    var url = "" 
    var instagramData, index, i;
    var  DEBUG = true;
		type: 'GET',
		url: url,
		contentType: "application/json",
		dataType: 'jsonp'
        instagramData =; 
        // preloads all 20 standard resolution photos
        var imgArray = [];
        for (i = 0; i < instagramData.length; i++){
            var image = new Image();
            image.src = instagramData[i].images.standard_resolution.url;
            imgArray.push( image );
        // loads initial main photo, URL to Instagram and Instagram caption text
        $("#largePhoto").attr("src", instagramData[0].images.standard_resolution.url ); 
        $("#photoLink").attr("href", instagramData[0].link );
        $("#photoLink").attr("title", instagramData[0].caption.text );
        // tooltip by Alessio Atzeni ( to display Instagram caption text when hovering
            var title = $(this).attr('title');
            $(this).data('tipText', title).removeAttr('title');
            $('<p class="tooltip"></p>')
        // removes tooltip when mouse leaves photo
        }, function () {
            $('this').attr('title', $(this).data('tipText'));
            $("#photoLink").attr("title", $(this).data('tipText') );
        // captures mouse position on screen 
            var mousex = e.pageX + 10; 
            var mousey = e.pageY + 10;
            .css({ top: mousey, left: mousex })

        index = 0; 
        // loops to generate four thumbnail photos
        for (i = 0; i <= 3; i++){ 
        $("#"+i).attr("src", instagramData[i].images.thumbnail.url )
        // clicks on navigation buttons reduce or increase index number to receive a new array
           if ($(this).attr("id") == "oldPhoto" && index < 16) {
           } else if ($(this).attr("id") == "newPhoto" && index >= 1) {
            for (i = 0; i <= 3; i++){ 
                $("#"+i).attr("src", instagramData[i+index].images.thumbnail.url )
        // thumbnail mouse hover
        $("#thumbs img").hover(function (){   
        // hover over thumbnails launches effects              
            // loads the main photo by combining id value with var index and fetching the sum from the array
            var elemId = this;                           
                if (DEBUG){
                    console.log("index number:" + index)
                    console.log("This is id: " + $(elemId).attr("id"))
                $("#largePhoto").attr("src", instagramData[parseInt($(elemId).attr("id"))+ index ].images.standard_resolution.url);
                $("#photoLink").attr("href", instagramData[parseInt($(elemId).attr("id"))+ index ].link);
                $("#photoLink").attr("title", instagramData[parseInt($(elemId).attr("id"))+ index ].caption.text);
                }, 300);
            },  function(){
            // when the cursors leaves a thumbnail, stops the animation and shows the main photo
            $("#largePhoto").stop( true, true );