Created
February 11, 2012 20:38
-
-
Save mager/1804049 to your computer and use it in GitHub Desktop.
Spotify Apps API - Handling arguments and creating navigational tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sp = getSpotifyApi(1); | |
var models = sp.require('sp://import/scripts/api/models'); | |
tabs(); // See function definition below | |
/* When a user clicks a tab, the "arguments" property on the | |
* Application object changes, and the tabs() function fires */ | |
models.application.observe(models.EVENT.ARGUMENTSCHANGED, tabs); | |
function tabs() { | |
var args = models.application.arguments; | |
$('.section').hide(); // Hide all sections | |
$('#'+args[0]).show(); // Show the current section | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment