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

              
                doctype html
html(lang="en")
  head
    title 
      | POP in Taipei
  body
    section.page.header-page
      .text-vertical-center
        h1
          | 住在天龍國的子民們
        h3
          | 想知道附近有多少公有地嗎?
        a(href="#about")
          i.big.circular.green.double.angle.down.icon
          
    section#about.about-page.page
      .text-vertical-center
        h1
          | 什麼是公有地?
        h3
          | 我也不知道,但你可以從
          a.big.ui.red.button(href="http://hackfoldr.org/POPonFire") 
              | 這裡
          | 找到答案
        a(href="#area")
          i.big.circular.orange.double.angle.down.icon
          
    section#area.area-page.page
      .text-vertical-center
        h1
          | 最想知道哪一區?
   
        .ui.selection.dropdown.choice-area
          input(type="hidden", name="area")
          .default.text
            | 
          i.dropdown.icon
          .menu
            a.item(data-value='中正區')
              | 中正區
            a.item(data-value='大同區')
               | 大同區
            a.item(data-value='中山區')
               | 中山區
            a.item(data-value='萬華區')
               | 萬華區
            a.item(data-value='信義區')
               | 信義區
            a.item(data-value='松山區')
               | 松山區
            a.item(data-value='大安區')
               | 大安區
            a.item(data-value='南港區')
               | 南港區
            a.item(data-value='北投區')
               | 北投區
            a.item(data-value='內湖區')
               | 內湖區
            a.item(data-value='士林區')
               | 士林區
            a.item(data-value='文山區')
               | 文山區
                
    section#map.map-page.page
      #map-canvas
      .text-vertical-center.map-notice
        h1
          | 請選擇地區
      
    footer
      .ui.divided.horizontal.link.list
        .item 
          | 資料來源:
          a(href="http://data.g0v.tw")
            | g0v零時資料中心
        .item
          | &copy; 2014 公有地大行動
 
  
              
            
!

CSS

              
                html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
}

.text-vertical-center {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}

.text-vertical-center h1 {
    color: white;
    margin: 0;
    padding: 0;
    font-size: 5em;
    font-weight: 800;
}

.text-vertical-center h3 {
    color: #EFEFEF;
    padding: 50px;
    font-size: 3em;
}

.page {
    display: table;
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #59ABE3;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    -o-background-size: cover;
}

.header-page {
    background-color: #59ABE3;
}

.about-page {
     background-color: #65C6BB; 
}

.area-page {
     background-color: #F4B350; 
}

.map-page {
    background-color: #D2D7D3;
}
.choice-area {
  margin: 30px;
  width: 500px;
}
#map-canvas {
  height: 100%;
  margin: 0px;
  padding: 0px;
  width: 100%;
}

footer {
    text-align: right;
    padding: 20px 0;
}
              
            
!

JS

              
                var taipei = 
{
  "中正區": {
    "lat": 25.0293008,
    "lng": 121.5205833
  },
  "大同區": {
    "lat": 25.0645027,
    "lng": 121.513314
  },
  "中山區": {
    "lat": 25.0685028,
    "lng": 121.5456014
  },
  "萬華區": {
    "lat": 25.0294936,
    "lng": 121.4978838
  },
  "信義區": {
    "lat": 25.0287142,
    "lng": 121.5723162
  },
  "松山區": {
    "lat": 25.0601727,
    "lng": 121.5593073
  },
  "大安區": {
    "lat": 25.0263074,
    "lng": 121.543846
  },
  "南港區": {
    "lat": 25.038392,
    "lng": 121.6219879
  },
  "北投區": {
    "lat": 25.1531486,
    "lng": 121.5174287
  },
  "內湖區": {
    "lat": 25.0835016,
    "lng": 121.5903754
  },
  "士林區": {
    "lat": 25.1347802,
    "lng": 121.5324453
  },
  "文山區": {
    "lat": 24.9880073,
    "lng": 121.5752716
  }
};
var showMap = function(area) {
  var lat = taipei[area].lat;
  var lng = taipei[area].lng;
  
  var popinfo = new google.maps.InfoWindow();
  var map = new google.maps.Map(document.getElementById('map-canvas'), {
    zoom: 15,
    scrollwheel: false,
    center: {lat: lat, lng: lng}
  });

  map.data.loadGeoJson('https://poponfire.herokuapp.com/api/taipei/' + area);
      // Set the stroke width, and fill color for each polygon
  var featureStyle = {
    fillColor: 'red',
    strokeWeight: 1
  };
  map.data.setStyle(featureStyle);

  map.data.addListener('click', function(event) {
     var properties = ['面積', '路段', '地號', '管理者', '使用分區'];

    var content = "<table class='ui table segment'>";
    properties.forEach(function(element, index, array){
      content += "<tr><td>"+ element + "</td><td>" + event.feature.getProperty(element) + "</td></tr>";
    });
    content += "</table>";

    popinfo.close();
    popinfo.setContent(content);
    popinfo.setPosition(event.latLng);
    popinfo.open(map);
  });
   
};


(function(){
  
  $('.dropdown').dropdown(
    {
    'onChange': function(val) {
      $('.map-notice').hide();
      showMap(val);
      $("html, body").animate(
        { scrollTop: $(document).height()- $(window).height() }, "slow");
    }
  });
  
})();
              
            
!
999px

Console