I have 3 buttons in the Link format with classes: .icon-play, .icon-pause and .icon-download, I want to change the play class with pause, as well as the inverse without influencing the download button , once the icon-play is clicked it will show a player and if the pause is activated it will hide the player.
var btnplay = $(".livro-audio a").find(".icon-play");
var btnpause = $(".livro-audio a").find(".icon-pause");
$( btnplay ).click(function() {
$( '.player-active' ).show();
$(this).attr('class', 'icon-pause');
if($('.player-active:visible')){
$( ".livro-audio" ).last().css( "margin-bottom", "150px" );
$( ".livro-video" ).last().css( "margin-bottom", "150px" );
}
});
$( btnpause ).click(function() {
$( '.player-active' ).hidden();
$(this).attr('class', 'icon-play');
if($('.player-active:hidden')){
$( ".livro-audio" ).last().css( "margin-bottom", "80px" );
$( ".livro-video" ).last().css( "margin-bottom", "80px" );
}
});
So far Lucas has given me a light, thus:
$(".livro-audio a").click(function(){
if($(this).hasClass('icon-play')){
$(this).addClass('icon-pause').removeClass('icon-play');
$('.player-active').show();
}
else{
$(this).addClass('icon-play').removeClass('icon-pause');
$('.player-active').hide();
}
});