admin管理员组文章数量:1415139
I coded timeline via vis.js. And I appended custom time item using by addCustomTime().
My situation is.
I want add fixed custom time, but It move when I drag it. Anbybody know how to prevent custom item move?
// DOM element where the Timeline will be attached
var container = document.getElementById('visualization');
// Create a DataSet (allows two way data-binding)
var items = new vis.DataSet([
{id: 1, content: 'item 1', start: '2013-04-20'},
]);
// Configuration for the Timeline
var options = {};
// Create a Timeline
var timeline = new vis.Timeline(container, items, options);
timeline.addCustomTime('2013-04-21'); // I want this item not moving.
<link href=".19.1/vis.min.css" rel="stylesheet"/>
<script src=".19.1/vis-timeline-graph2d.min.js"></script>
<div id="visualization"></div>
I coded timeline via vis.js. And I appended custom time item using by addCustomTime().
My situation is.
I want add fixed custom time, but It move when I drag it. Anbybody know how to prevent custom item move?
// DOM element where the Timeline will be attached
var container = document.getElementById('visualization');
// Create a DataSet (allows two way data-binding)
var items = new vis.DataSet([
{id: 1, content: 'item 1', start: '2013-04-20'},
]);
// Configuration for the Timeline
var options = {};
// Create a Timeline
var timeline = new vis.Timeline(container, items, options);
timeline.addCustomTime('2013-04-21'); // I want this item not moving.
<link href="https://cdnjs.cloudflare./ajax/libs/vis/4.19.1/vis.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare./ajax/libs/vis/4.19.1/vis-timeline-graph2d.min.js"></script>
<div id="visualization"></div>
Share
Improve this question
asked Apr 20, 2017 at 6:14
lv0gun9lv0gun9
6218 silver badges24 bronze badges
2 Answers
Reset to default 4https://github./almende/vis/issues/1296
I added this code to css.
.vis-custom-time {
pointer-events: none;
}
As @dapriett said in this ment in the GitHub issue that @lv0gun9 linked, you can do this instead:
timeline.addCustomTime(date, id)
timeline.customTimes[timeline.customTimes.length - 1].hammer.off("panstart panmove panend");
This disables the move events on the custom time element. With @lv0gun9's css solution you'll also disable the tooltip that tells you the element's precise date when hovering on it.
本文标签: javascriptHow to prevent visjs timeline quotcustomTimequot item moveStack Overflow
版权声明:本文标题:javascript - How to prevent vis.js timeline "customTime" item move? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745229137a2648745.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论