我有两个divs
,一个是主页,另一个是显示和隐藏主页的其他页面。我的问题是,当显示第二个 div 时,标签画布没有出现。
<script type="text/javascript">
setTimeout(function() { window.onload(); }, 700);
window.onload = function() {
try {
TagCanvas.Start('myCanvas','tags',{
textFont: 'Impact,"Arial Black",sans-serif',
textHeight: 25,
textColour: '#ff0000',
outlineColour: '#ff00ff',
reverse: true,
depth: 0.8,
maxSpeed: 0.05,
shape: "sphere",
dragControl: true,
txtOpt: true
});
} catch(e) {
// something went wrong, hide the canvas container
document.getElementById('myCanvasContainer').style.display = 'none';
}
};
</script>
<script type="text/javascript">
setTimeout(function() { window.onload(); }, 700);
window.onload = function() {
try {
TagCanvas.Start('myCanvasSele','tagsSele',{
textFont: 'Impact,"Arial Black",sans-serif',
textHeight: 25,
textColour: '#ff0000',
outlineColour: '#ff00ff',
reverse: true,
depth: 0.8,
maxSpeed: 0.05,
shape: "sphere",
dragControl: true,
txtOpt: true
});
} catch(e) {
// something went wrong, hide the canvas container
document.getElementById('myCanvasContainerSele').style.display = 'none';
}
};
</script>
...
<!---------- Home Page -------->
<div class="container" id="index">
<div class="starter-template">
<div class="col-md-8" style="height:500px">
<div id="myCanvasContainer">
<canvas width="690" height="450" id="myCanvas">
</canvas>
</div>
<div id="tags">
<ul id="tagList">
<li>Messi</li>
<li>Cristiano Ronaldo</li>
<li>Bale</li>
<li>Neymar</li>
</ul>
</div>
</div>
...
<!-------------- Page of Teams ---------->
<div class="container" id="selecoes">
<div class="starter-template">
<div class="col-md-8" style="height:500px">
<div id="myCanvasContainerSele">
<canvas width="690" height="450" id="myCanvasSele">
</canvas>
</div>
<div id="tagsSele">
<ul id="tagListSele">
<li>Portugal</li>
<li>Brazil</li>
<li>France</li>
<li>England</li>
</ul>
</div>
</div>
例如,当我在 Messi 中单击时,会显示 Teams 的页面(是第二个 div)并隐藏主页,但标签画布不像主页那样出现。