Skip to content

Instantly share code, notes, and snippets.

@dcneiner
Created July 12, 2010 05:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dcneiner/98b9624d8596662e7ece to your computer and use it in GitHub Desktop.
Save dcneiner/98b9624d8596662e7ece to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$.YQL = function(query, callback) {
$.getJSON('http://query.yahooapis.com/v1/public/yql?callback=?', { q: query, format: 'json' }, callback);
};
$.YQL("select * from rss where url='http://weather.yahooapis.com/forecastrss?p=UKXX0133'", function (data) {
var w = data.query.results.item,
klass = w.condition.text,
encodedclass = klass.replace(/\s+/g, '-').toLowerCase();
$('body').addClass(encodedclass);
});
var weather = $("#weather")
.show()
.delegate('li', 'click', function (e) {
document.body.className = this.className;
e.preventDefault();
}),
menuYloc = weather.position().top;
$(window).scroll(function () {
weather.animate({top: menuYloc + $(document).scrollTop()}, {duration:500, queue: false});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment