Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                    <!-- POPUP -->
    <div id="popup-info">
        <div style="font-weight:bold; font-size:1.2em;">This is a title</div>
        <div style="padding-top:10px;">This is some text.</div>
        <div id="popup-close-button" onclick="showPopup()">X</div>
    </div>
    <!-- ZOOM CONTROLS -->
    <div id="zoom-controls">
        <div style="width:80%; height:28%; padding-top:12%; border:1px solid #000; text-align:center; background-color:rgba(255,255,255,0.6);" onClick="zoomIn()">IN</div>
        <div style="width:80%; height:28%; padding-top:12%; border:1px solid #000; text-align:center; background-color:rgba(255,255,255,0.6); margin-top:10%;" onClick="zoomOut()">OUT</div>
    </div>
    <!-- NAVIGATION CONTROLS -->
    <div id="nav-controls">
        <div style="width:15%; height:35%; padding-top:5%; border:1px solid #000; text-align:center; background-color:rgba(255,255,255,0.6); margin:0 0 2% 5%;" onClick="scrollUp()">U</div>
        <div style="width:15%; height:35%; padding-top:5%; border:1px solid #000; text-align:center; background-color:rgba(255,255,255,0.6); margin:0 0 0 5%;" onClick="scrollDown()">D</div>
        <div style="width:15%; height:35%; padding-top:5%; border:1px solid #000; text-align:center; background-color:rgba(255,255,255,0.6); position:relative; top:-90%; left:-15%;" onClick="scrollToLeft()">L</div>
        <div style="width:15%; height:35%; padding-top:5%; border:1px solid #000; text-align:center; background-color:rgba(255,255,255,0.6); position:relative; top:-148%; left:20%; margin:0 0 0 5%;" onClick="scrollToRight()">R</div>
        <div class="clear"></div>
    </div>
    <!-- MAP CONTAINER -->
    <div id="map-container">
        <div style="position:absolute; top:550px; left:870px; width:150px; height:150px; background-color:#F00; opacity:0.8;" onclick="showPopup()"></div>
    </div>
              
            
!

CSS

              
                #map-container{
    z-index:-9000;
    width:2000px;
    height:1414px;
    background-image:url(http://www.vectorworldmap.com/vectormaps/vector-world-map-v2.2.jpg);
    background-repeat:no-repeat;
      background-position:center;
    background-size:cover;
}
#zoom-controls{
    position:fixed;
    top:5%;
    left:5%;
    width:5%;
    height:10%;
    margin:auto;
    z-index:2000;
}
#nav-controls{
    position:fixed;
    top:30%;
    left:5%;
    width:25%;
    height:10%;
    margin:auto;
    /*background-color:#F00;
    opacity:0.7;*/
    z-index:2000;
  
}
#popup-info{
    margin-left:25%;
    width:46%;
    position:fixed;
    top:15%;
    padding:2%;
    background-color:#f9e3b2;
    opacity:0;
}
#popup-close-button{
    position:fixed;
    left:74%;
    top:13%;
    width:30px;
    height:23px;
    padding-top:7px;
    text-align:center;
    border:1px solid #000;
    border-radius:30px;
    background-color:#f9e3b2;
}
.clear{
    clear:both;
}
              
            
!

JS

              
                //GSAP
function zoomIn(){
    var mapContainer = document.getElementById("map-container");
    //TweenMax.set(mapContainer,{transformOrigin: "50% 50% 0",scale:1});
    TweenMax.to(mapContainer, 0.4, { scale: "+=1"});
  //console.log(mapContainer._gsTransform);
}
function zoomOut(){
    var mapContainer = document.getElementById("map-container");
    
    //console.log(mapContainer._gsTransform.scaleX);
    if(mapContainer._gsTransform !== undefined){
        if(mapContainer._gsTransform.scaleX != 1){
            TweenMax.to(mapContainer, 0.4, { scale: "-=1"});
        }
    }
}

function scrollDown(){    
    var y = $(window).scrollTop();
    $("html, body").animate({ scrollTop: y + 150 }, 500);
}

function scrollUp(){
    var y = $(window).scrollTop();
    $("html, body").animate({ scrollTop: y - 150 }, 500);
}

function scrollToLeft(){
    var x = $(window).scrollLeft();
    $("html, body").animate({ scrollLeft: x - 150 }, 200);
}

function scrollToRight(){
    var x = $(window).scrollLeft();
    $("html, body").animate({ scrollLeft: x + 150 }, 200);
}

//show/hide popup
function showPopup(){
    $.getJSON( "data.json", function( json ) {
        console.log( "JSON Data: " + json[1].Forename );
    });
	var popupState = document.getElementById('popup-info');
	//if it is currently hidden else it is showing
	if(popupState.style.opacity == 0){
		popupState.style.zIndex = "4000";
		popupOpacity = 1;	
	}	else{
			popupOpacity = 0;
		}
	$("#popup-info").animate({
		opacity:popupOpacity
	}, 500);
}
              
            
!
999px

Console