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.

            
                     <h1>MAP WITH METEORITES FOUND IN POLAND</h1>
        <div class="wholecontent">

        </div>
        <div class="button">
            <button id="click">LOAD MAP DATA</button>
                <div>
                    <p>Only Meteorites with mass > 1g shown on the MAP!!!</p>
                </div>            
        </div>
        
        <div class="tableMet">
            <div class="loadTable">
                <button id="loadDataTable">Load Table Data</button>
                <div>
                    <p>Please be advised that Meteorites with mass of 1g means UKNOWN MASS!!!</p>
                </div>
            </div>
            <div class="tableContent">
                
            </div>
        </div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Luckiest+Guy);
* {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
}

body {
  background-color: aqua;
}

h1 {
  text-align: center;
  margin-top: 2rem;
  margin-bottom: 2rem;
  font-family: "Luckiest Guy", Helvetica, sans-serif;
  text-shadow: 4px 4px 0px #ba3a1a;
  letter-spacing: 0.1rem;
  color: floralwhite;
}

.wholecontent {
  position: relative;
  background: url("http://res.cloudinary.com/trodison/image/upload/v1510165375/poland-cities_tkweb6.svg");
  margin: 0 auto;
  background-repeat: no-repeat;
  background-size: contain;
  border: 5px solid yellow;
  width: 862px;
  height: 838px;
}

.met {
  position: absolute;
  border: 1px solid red;
}

.drawLine {
  position: absolute;
  font-weight: bold;
  text-decoration: underline;
  min-width: 190px;
  min-height: 30px;
  color: forestgreen;
  padding: 5px;
  border: 1px solid red;
  background-color: whitesmoke;
  text-align: center;
  opacity: 0.8;
}

.button {
  padding: 3rem;
  padding-top: 1rem;
  text-align: center;
}

#click {
  display: inline-block;
  padding: 10px 20px 10px 20px;
  background-color: cadetblue;
  border: 1px solid red;
  margin-bottom: 1rem;
}

.tableContent {
  /*   display: flex;
    flex-direction: column;
   */
  display: table;
  table-layout: fixed;
  border-spacing: 2px;
  border-collapse: separate;
}

.tableMet div:nth-child(2) {
  margin: 1rem auto;
}

.tableContent > div > div {
  /*    align-self: center;
    margin: 0.5rem 0 0.5rem 0;
    font-weight: bold; */
  border: 1px solid red;
  padding: 10px;
  text-align: center;
}

.loadTable {
  text-align: center;
  margin-bottom: 1rem;
}

#loadDataTable {
  padding: 10px 20px 10px 20px;
  display: inline-block;
  text-transform: uppercase;
  background-color: cadetblue;
  border: 1px solid white;
  font-weight: bold;
  letter-spacing: 0.05rem;
  color: gold;
  margin-bottom: 1rem;
}

.tableContent > div:nth-child(even) {
  padding: 10px;
  background-color: brown;
}

.tableContent > div:nth-child(odd) {
  padding: 10px;
  background-color: darkgoldenrod;
}

            
          
!
            
              var meteo = [];
var pictureWidth = 862;
var pictureHeight = 838;
var startLong = 13.8;
var startLat = 48.7;
var endLong = 24.33;
var endLat = 55.2;

var divText = "";

var temp = "";

var tableData = "";



function getData(){
    var result = null;
    $.ajax({
        
        url: "https://raw.githubusercontent.com/LightTest/poland-meteor/master/poland-right-file-meteors.json",


        dataType: "json",
        success: function(data){
            result = data;
        },
        async: false
    });
    return result;
}

meteo = getData();


$(document).ready(function() {
     


  $("#click").click(function() {
    for(i = 0; i < 30; i++) {
     
        if( meteo[i][2] != 1 && meteo[i][3] != 1 ) {
        
        divText = '<div class="drawLine">' + 'Name: ' + meteo[i][0] +'</div>';
        $(".wholecontent").prepend(divText);        
       
        $(".wholecontent").prepend('<div class="met"></div>');
        $(".met:first-child").css("width", Math.sqrt(meteo[i][2])/3);
        $(".met:first-child").css("height", Math.sqrt(meteo[i][2])/3);
        $(".met:first-child").css("background-color", "rgba(255,0,255,0.3)");
        $(".met:first-child").css("border-radius", "50%");

        $(".met:first-child").css("left", (convertToSvgWidth(meteo[i][4],startLong , endLong , pictureWidth)));         
        $(".met:first-child").css("bottom", (convertToSvgHeight(meteo[i][3],startLat, endLat, pictureHeight)));        
        $(".met:first-child").css("transform", "translate(-50%,50%)"); 
// To draw a line
         
        $(".drawLine:nth-child(2)").css("left", (convertToSvgWidth(meteo[i][4],startLong , endLong , pictureWidth)+ (Math.sqrt(meteo[i][2])/3)/2  )  );         
        $(".drawLine:nth-child(2)").css("bottom", (convertToSvgHeight(meteo[i][3],startLat, endLat, pictureHeight)));    
            

        
        divText = "";
    }
    
    }
     $("#click").prop("disabled",true); 
  });
    
    $("#loadDataTable").click(function() {

       
      for(var j = 0; j < 30; j++) { 
          
          tableData = '<div style="display: table-row;">' + '<div style="display: table-cell;">' + 'N: ' + (j+1) + '</div>' + '<div style="display: table-cell;">' + ' Name: ' + meteo[j][0] + '</div>' + '<div style="display: table-cell;">' + ' Year of Found: ' + meteo[j][1] + '</div>' + '<div style="display: table-cell;">' + ' Place Of Found: ' + meteo[j][6] + '</div>' + '<div style="display: table-cell;">' + ' Meteorite Type: ' + meteo[j][7] + '</div>' + '<div style="display: table-cell;">' + ' Mass in g: ' + meteo[j][2] + '</div></div>';
         $(".tableContent").append(tableData);  
            tableData = "";
      }  


       $("#loadDataTable").prop("disabled",true); 
        
    });
    
});

function convertToSvgWidth(yourLong, startLong , endLong , pictureWidth ) {
    
    return (yourLong-startLong)*(pictureWidth/(endLong-startLong));
    
}

function convertToSvgHeight(yourLat, startLat, endLat, pictureHeight){
    return (yourLat-startLat)*(pictureHeight/(endLat-startLat));
}


            
          
!
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.

Console