Load Morris.js graph in active tab (bootstrap)

两盒软妹~` 提交于 2019-11-29 17:57:39

You need to use the master-branch of morris.js which has support for

redraw()

and call that on the event

shown.bs.tab

more info here: http://www.doidea.se/blog/morris-js-charts-in-bootstrap-tabs

or js-fiddle: http://jsfiddle.net/rbsthlm/vbfzr/

Make both tabs active and then:

$('.nav-tabs li a').last().tab('show');
$('.nav-tabs li a').first().tab('show');

In my case none of the above solutions worked.

What worked for me was to use the jquery ui tabs instead (link). These worked like a charm.

Your code would only need slight re-writing.

BTW all the fiddles I've found that try to catch event 'shown.bs.tab' don't work anymore for some reason.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!