jplayer实现带播放列表封面等丰富功能的音乐播放器代码

代码语言:html

所属分类:多媒体

代码描述:jplayer实现带播放列表封面等丰富功能的音乐播放器代码

代码标签: jplayer 播放列表 封面 丰富 功能 音乐 播放器 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" class="no-js">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    display: block
}

body {
    line-height: 1;
}

ol, ul {
    list-style: none;
}

blockquote, q {
    quotes: none;
}

blockquote:before, blockquote:after, q:before, q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

/*-----------------------------------*/
/* General Styles */
/*-----------------------------------*/
body {
    background: #D2D5D6;
}

.focus-container {
    margin: 0 auto;
    width: 600px;
}

.boxed {
    background: none repeat scroll 0 0 #EEF1F2;
    border-radius: 18px;
    margin-bottom: 30px;
    margin-top: 50px;
    position: relative;
    z-index: 0;
    -webkit-box-shadow: 0 0 12px rgba(58, 51, 46, 0.26);
    -moz-box-shadow: 0 0 12px rgba(58, 51, 46, 0.26);
    box-shadow: 0 0 12px rgba(58, 51, 46, 0.26);
}

/******************************************Responsive******************************************/
@media(max-width: 600px) {
    .focus-container {
        width: 400px;
    }
}

@media(max-width: 360px) {
    .focus-container {
        width: 300px;
    }

    .song_title img {
        height: 200px;
    }
}
    </style>

    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.1.11.min.js"></script>
    <!-- stylesheet -->
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/jplayer.css">
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/metroplayericon.css">
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.jplayer.min.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jplayer.playlist.min.js"></script>
    <script>
        jQuery(document).ready(function() {
        var a = $(".jp-audio").length;
        var b = "";
        if (a > 0) {
            for (var c = 1; c <= a; c++) {
                $(".jp-audio").eq(c - 1).addClass("jp-audio" + c)
            }
            setTimeout(function() {
                for (var e = 1; e <= a; e++) {
                    b = $(".jp-audio" + e + " .jp-playlist ul li.jp-playlist-current .jp-playlist-item").html();
                    $(".jp-audio" + e + " .song_title").html(b)
                }
            }, 1000);
            function d() {
                setTimeout(function() {
                    for (var e = 1; e <= a; e++) {
                        $(".jp-audio" + e + " .jp-previous, .jp-audio" + e + " .jp-next").removeClass("disabled");
                        if ($(".jp-audio" + e + " .jp-playlist ul li:last-child").hasClass("jp-playlist-current")) {
                            $(".jp-audio" + e + " .jp-next").addClass("disabled")
                        }
                        if ($(".jp-audio" + e + " .jp-playlist ul li:first-child").hasClass("jp-playlist-current")) {
                            $(".jp-audio" + e + " .jp-previous").addClass("disabled")
                        }
                        b = $(".jp-audio" + e + " .jp-playlist ul li.jp-playlist-current .jp-playlist-item").html();
                        $(".jp-audio" + e + " .song_title").html(b)
                    }
                }, 0)
            }
            $(".jp-previous, .jp-next, .jp-playlist ul").click(function() {
                d()
            });
            $(".jp-jplayer").on($.jPlayer.event.ended, function(e) {
                d()
            })
        }
        $(".jp-playlist-toggle").click(function() {
            var e = $(this);
            for (var f = 1; f <= a; f++) {
                if (e.parents(".jp-audio").hasClass("jp-audio" + f)) {
                    $(".jp-audio" + f + " .jp-playlist").slideToggle("slow")
                }
            }
        })
    });
            $(document).ready(function() {
        new jPlayerPlaylist({
            jPlayer: "#jquery_jplayer_1",
            cssSelectorAncestor: "#jp_container_1"
        }, [{
            title: "<img src='//repo.bfw.wiki/bfwrepo/image/600d6cfee7691.png' alt='' /><div class='item-song'>He lives in you, he lives in me</div><div class='item-artist'>Elton John, Hans Zimmer</div>",
            itunes: "#",
            amazon: "#",
            buy: "",
            download: "",
            mp3: "//repo.bfw.wiki/bfwrepo/sound/5c89fd22dea6948307.mp3",
            oga: "&qu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0