Created
April 20, 2011 07:40
-
-
Save mataspetrikas/930612 to your computer and use it in GitHub Desktop.
activate tracks without playing in the SoundCloud custom player
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
// add this after the '.sc-trackslist li' click listener | |
$(document).bind('activateTrack', function(event) { | |
var $track = $(event.target), | |
$player = $track.closest('.sc-player'), | |
trackId = $track.data('sc-track').id; | |
updateTrackInfo($player, trackId); | |
$track.addClass('active').siblings('li').removeClass('active'); | |
$('.artworks li', $player).each(function(index) { | |
$(this).toggleClass('active', index === trackId); | |
}); | |
}); | |
// and then in your script trigger the custom event on the particular items | |
$(yourselected item).trigger('activateTrack'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment