简体   繁体   中英

jPlayer playlist title element

I have seen similar questions, but no solutions. I have jPlayer working beautifully except for one thing... In "playlist" mode, the title element is set to display:none . Is there a setting in the constructor to override this?

Thanks in advance

A solution is to use a jQuery listener and add the title programmatically as it plays...

$("#music").bind($.jPlayer.event.play, function(event)
{
    $.each(player.playlist, function(index, song)
    {
        if(index == player.current)
        {
            $(".songTitle").html(song.title);
        }
    });
});

Where #music is the div you initally attach jplayer too and .songTitle is the class of the element where you want the title displayed.

You can force the css to show the title item by adding "important" like this:

div.jp-details {
    display: block !important;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM