El pronóstico del clima con jQuery

simpleWeather es un sencillo plugin desarrollado con el framework jQuery para la creación de atractivos widgets con el pronostico del tiempo.

La información la obtiene directamente desde el sitio del clima de Yahoo utilizando su API. Muchos se estarán preguntando ¿por qué no utilizar directamente el widget de Yahoo?, la respuesta es sencilla: personalización. Si utilizamos el plugin podremos personalizar al máximo el diseño del widget cosa que es muy difícil de hacer utilizando el widget oficial de Yahoo.

plugin jquery para datos del clima desde Yahoo

Ejemplo de uso:

<script type="text/javascript">
$(function() {
	$.simpleWeather({
		zipcode: '90210',
		unit: 'f',
		success: function(weather) {
			html = '<h2>'+weather.city+', '+weather.region+'</h2>';
			html += '<img style="float:left;" width="125px" src="'
			+weather.image+'">';
			html += '<p>'+weather.temp
			+'&deg; '+weather.units.temp+'<br /><span>'
			+weather.currently+'</span></p>';
			html += '<a href="'+weather.link
			+'">View Forecast &raquo;</a>';

			$("#weather2").html(html);
		},
		error: function(error) {
			$("#weather2").html('<p>'+error+'</p>');
		}
	});
});
</script>

Web: simpleWeather

Categorizado en: