Skip to content

Instantly share code, notes, and snippets.

@Olical
Created April 5, 2011 09:47
Show Gist options
  • Save Olical/903349 to your computer and use it in GitHub Desktop.
Save Olical/903349 to your computer and use it in GitHub Desktop.
Examples for sparkjs.co.uk
// Add an event listener for clicking the button (an input with a class of toggleButton)
Spark('input.toggleButton').event('click', function(e) {
// When it is clicked toggle the li's
// If you wanted them to fade when toggling just pass a string to it containing 'fade'
Spark('li').toggle();
});
// Loads my tweets over JSONP and passes them to the displayTweets function
Spark.jsonp('http://api.twitter.com/1/statuses/user_timeline.json', 'displayTweets', 'screen_name=SparkJavaScript&count=5');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment