Commit cc88ba6e by 侯昆

js修改

1 parent 141e41db
......@@ -13,12 +13,14 @@
<script src="${ctx}/static/js/plugins/jquery.min.js"></script>
<script src="${ctx}/static/js/vendor.js" merge="true"></script>
<script>
$(function () {
$('.js-collapse').each(function() {
var $this = $(this);
$($this.attr('href')).on('show.bs.collapse', function() {
$($this.siblings().attr('href')).collapse('hide');
});
});
})
</script>
</head>
<body>
......@@ -662,8 +662,7 @@
<script src="/static/js/plugins/vis/vis.min.js"></script>
<c:if test="${vo.word eq '心脏'}">
<script>
$(function () {
$(function() {
// 图谱
var nodeDatas = [{
atlasNodes: [{
......@@ -1901,7 +1900,7 @@
]
}
];
// 图谱
function draw(atlasData, index) {
var container = document.getElementById('atlas-' + index);
var data = {
......@@ -1911,13 +1910,13 @@
var options = {
nodes: {
shape: 'dot',
borderWidth: 2,
size: 25,
color: {
border: '#6faae8',
background: '#ecf6ff',
border: '#bda29a',
background: '#bda29a',
highlight: {
border: '#6faae8',
background: '#ecf6ff'
border: '#bda29a',
background: '#bda29a'
}
},
font: {
......@@ -1932,21 +1931,21 @@
var $carouse = $('#carouselExampleControls'),
newVis = null,
oldVis = null;
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
$('a[data-toggle="tab"]').on('show.bs.tab', function(e) {
if ($(e.target).text() === '图谱') {
newVis = draw(nodeDatas, 0);
}
}).on('hidden.bs.tab', function (e) {
}).on('hidden.bs.tab', function(e) {
if ($(e.target).text() === '图谱' && newVis) {
newVis.destroy();
$carouse.carousel(0);
}
});
$carouse.on('slid.bs.carousel', function (data) {
$carouse.on('slid.bs.carousel', function(data) {
if (oldVis) oldVis.destroy();
})
.on('slide.bs.carousel', function (data) {
.on('slide.bs.carousel', function(data) {
oldVis = newVis;
newVis = draw(nodeDatas, data.to);
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!