问题描述
- timeline.js生成时间轴问题
-
<!DOCTYPE html><html><head> <meta charset=""utf-8""/> <title>Timeline</title> <!-- The default timeline stylesheet --> <link rel=""stylesheet"" href=""assets/css/timeline.css""/> <!-- Our customizations to the theme --> <link rel=""stylesheet"" href=""assets/css/styles.css""/></head><body><header> <h1 id=""nodeName""></h1></header><div id=""timeline""> <!-- Timeline.js will genereate the markup here --></div><!-- JavaScript includes - jQuery turn.js and our own script.js --><script src=""assets/js/jquery-1.7.1.js""></script><script src=""assets/js/timeline.js""></script><script> var obj = {timeline"": {headline"": ""Events timeline""type"": ""default""startDate"": ""20154""text"": ""<i><span class='c1'>事件</span> & <span class='c2'>时间轴</span></i>""date"": [ {startDate"": ""2016415""headline"": ""违法违规|债务违约""text"": ""<a href='http://business.sohu.com/20160415/n444244012.shtml' target='_blank'>交易商协会调查绿地控股信披违规 或与云峰违约有关</a>""asset"": {media"": """"credit"":""<a href='http://business.sohu.com/20160415/n444244012.shtml' target='_blank'>违规|违约</a>""caption"": """" } } {startDate"": ""201649""headline"": ""违约""text"": ""<a href='http://finance.qq.com/a/20160409/017663.htm' target='_blank'>云峰债违约内幕:信披夸大净资产超十倍</a>""asset"": {media"": ""assets/img/shots/sidebar_s3.jpg""credit"": """"caption"": """" } } ] } }; //**************** (function () { var timeline = new VMM.Timeline(); timeline.init(obj); })();</script></body></html>报错,请问如何解决?
解决方案
解决方案二:
刚才测试了timeline.js好像是不支持数据源直接为json对象,将数据存为json文件(不包含var obj = 这个内容,注意utf-8存储编码),然后
timeline.init(obj);
改为
timeline.init(""json文件路径"");
就没有问题了
时间: 2024-11-03 05:27:12