public/assets/frontend/js/handleAudio.js
// restart another song when active one song
restart another song when active one song
restart another song when active one song
function resetAudio() {
    document.addEventListener('play', function(e) {
        for (var i = 0; i < audios.length; i++) {
            if (audios[i] != e.target) {
                audios[i].currentTime = 0;
                audios[i].pause();
            } else {
                var classGrandpa = $(e.target).parent().parent().parent().attr('class');
                var poster = $('.' + classGrandpa + ' .main_track_img').attr('src');
                var trackName = $('.' + classGrandpa + ' .info .trackSong').attr('track');
                var artistName = $('.' + classGrandpa + ' .info .trackArtist').attr('artist');
                changePlayerInfomation(poster, trackName, artistName);
            }
        }
    }, true);
}
function resetAudio ( ) { document . addEventListener ( 'play' , function ( e ) { for ( var i = 0 ; i < audios . length ; i ++ ) { if ( audios [ i ] != e . target ) { audios [ i ] . currentTime = 0 ; audios [ i ] . pause ( ) ; } else { var classGrandpa = $ ( e . target ) . parent ( ) . parent ( ) . parent ( ) . attr ( 'class' ) ; var poster = $ ( '.' + classGrandpa + ' .main_track_img' ) . attr ( 'src' ) ; var trackName = $ ( '.' + classGrandpa + ' .info .trackSong' ) . attr ( 'track' ) ; var artistName = $ ( '.' + classGrandpa + ' .info .trackArtist' ) . attr ( 'artist' ) ; changePlayerInfomation ( poster , trackName , artistName ) ; } } } , true ) ; }
restart another song when active one song
restart another song when active one song