Jplayer无法正常工作

时间:2014-07-17 12:48:12

标签: php jquery smarty jplayer

我已经预见到聪明了

{foreach from=$listFeature item=item} 

和这个

<script type="text/javascript">
                $(document).ready(function(){
                var myCirclePlayer = new CirclePlayer("#jquery_jplayer_{$item.id_product}",
            {
                mp3: "download/{$item.audio_link}",
                oga: "download/{$item.audio_link}"
            }, {
                cssSelectorAncestor: "#cp_container_{$item.id_product}"
            });

        });
        </script>

还:

<div id="jquery_jplayer_{$item.id_product}" class="cp-jplayer"></div>

但它无法正常工作,音频播放5-6个元素,而网站上的其他js代码无法正常工作。 对不起我的英文

1 个答案:

答案 0 :(得分:0)

尝试添加{literal} -blocks以避免聪明地与JavaScript语法混淆:

<script type="text/javascript">
{literal}
$(document).ready(function(){
  var myCirclePlayer = new CirclePlayer("#jquery_jplayer_{/literal}{$item.id_product}{literal}",
  {
  {/literal}
    mp3: "download/{$item.audio_link}",
    oga: "download/{$item.audio_link}"
  {literal}
  }, {
    cssSelectorAncestor: "#cp_container_{/literal}{$item.id_product}{literal}"
  });
});
{/literal}
</script>