Skip to content

Commit

Permalink
33. jQuery: Buzz Library – Assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Colleen committed Sep 29, 2015
1 parent 9f33206 commit 64121c9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/album.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ var previousSong = function() {
$lastSongNumberCell.html(lastSongNumber);
};

var togglePlayFromPlayerbar = function() {
var $currentlyPlayingCell = getSongNumberCell(currentlyPlayingSongNumber);
if (currentSoundFile.isPaused()) {
$currentlyPlayingCell.html(pauseButtonTemplate);
$(this).html(playerBarPauseButton);
currentSoundFile.play();
} else if (currentSoundFile) {
$currentlyPlayingCell.html(playButtonTemplate);
$(this).html(playerBarPlayButton);
currentSoundFile.pause();
}
};

var playButtonTemplate = '<a class="album-song-button"><span class="ion-play"></span></a>';
var pauseButtonTemplate = '<a class="album-song-button"><span class="ion-pause"></span></a>';
var playerBarPlayButton = '<span class="ion-play"></span>';
Expand All @@ -187,9 +200,11 @@ var currentVolume = 80;

var $previousButton = $('.main-controls .previous');
var $nextButton = $('.main-controls .next');
var $playPauseButton = $('.main-controls .play-pause');

$(document).ready(function() {
setCurrentAlbum(albumPicasso);
$previousButton.click(previousSong);
$nextButton.click(nextSong);
$playPauseButton.click(togglePlayFromPlayerbar);
});

0 comments on commit 64121c9

Please sign in to comment.