Weather
Weather Module
by jean-philippe janecek
HTML
<div class="weatherModule">
<p class="currentConditions"></p>
<div class="currentIcon"></div>
</div>
CSS
.weatherModule {
background:#f2f2f2;
height:150px;
width:250px;
border: 1px dashed #ccc;
padding: 1em;
}
.currentConditions {
float: left;
}
.weatherModule {
padding: 1em;
}
.currentIcon {
float: left;
margin: 0 .75em;
}
CoffeeScript
$.ajax
url: 'http://api.wunderground.com/api/' + apikey + '/conditions/q/PA/Beuil.json'
dataType: 'jsonp'
data: 'url'
success: (data) ->
for index, result of data
temp = Math.round result.temp_c
icon = result.icon_url
weather = result.weather
$('p.currentConditions').html "Beuil - Currently #{temp} ° C and #{weather}"
$('div.currentIcon').html "<img src='#{icon}' >"