Commit cc88ba6e by 侯昆

js修改

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