您的位置:首页 > Web前端 > JQuery

jquery sparkline中在未加载的DOM元素中无法显示图标

2015-01-27 13:15 239 查看


How do I draw a sparkline on an element that is not yet in the DOM?

You need to know two things:
The element you create must have some initial content, even if it's just  
After the element is inserted into the DOM (and visible), you must call 
$.sparkline_display_visible()
 to actually display it

Eg.
// create an element and draw a sparkline
var barchart = $('<span> </span>');
barchart.sparkline([1,2,3,2], {type: 'bar'});
// insert the element somewhere into the DOM
$('#mycharts').append(barchart);
// actually render any undrawn sparklines that are now visible in the DOM
$.sparkline_display_visible();



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: