0

TimelineJs インスタンスで、ページ内の変数から JSON データをロードすることは可能ですか?

  <div id="timeline-embed"></div>
  <script type="text/javascript">

    var timeline_config = {
     width: "100%",
     height: "100%",
     source: 'example_json.json'
    }
  </script>
  <script type="text/javascript" src="../compiled/js/storyjs-embed.js"></script>

これは、timelineJS の例のデフォルト コードです。基本的に私はに置き換えようとしてsource: 'example_json.json'います

source: '{
    "timeline":
    {
        "headline":"Sh*t People Say",
        "type":"default",
        "text":"People say stuff",
        "startDate":"2012,1,26",
        "date": [
            {
                "startDate":"2011,12,12",
                "endDate":"2012,1,27",
                "headline":"Vine",
                "text":"<p>Vine Test</p>",
                "asset":
                {
                    "media":"https://vine.co/v/b55LOA1dgJU",
                    "credit":"",
                    "caption":""
                }
            },
            {
                "startDate":"2012,1,26",
                "endDate":"2012,1,27",
                "headline":"Sh*t Politicians Say",
                "text":"<p>In true political fashion, his character rattles off common jargon heard from people running for office.</p>",
                "asset":
                {
                    "media":"http://youtu.be/u4XpeU9erbg",
                    "credit":"",
                    "caption":""
                }
            }
]
    }
}'

しかし、それは機能しません

4

1 に答える 1