jPlayer text link does not play

喜夏-厌秋 提交于 2019-12-05 18:04:09

there were a couple of things..

  1. this, when used within a click event refers to the clicked element, not your jPlayer element
  2. there is no such jPlayer method as setFile - it's setMedia

try this:

$(document).ready(function(){
    $("#jquery_jplayer").jPlayer({
        swfPath: "/ui/core/js/jPlayer/",
        supplied: "mp3",
        wmode: "window"
    });

    $('.voice').click(function(e) {
        e.preventDefault();
        $("#jquery_jplayer")
            .jPlayer("setMedia", {mp3: this.href })
            .jPlayer("play");
    });
});
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!