vis-timeline
vis-timeline copied to clipboard
onclick event stolen
just pulled down newest timeline as a replacement of deprecated vis.js; worked fine, but: in the timeline content, i have a link for "do you want to know more" with an onclick popping up a little DIV. it does not work anymore. in FF debugger i saw, that a mouse event "onclick" is raised, but with "currentTarget: div.vis-timeline.vis-bottom.vis-ltr", not my DIV. why was the deprecated version capable of doing what the new version does, without stealing the onclick callback? resp, how can i avoid/ swicht off this in the present version to get my onclick back?
my code:
var container = document.getElementById('visualization0');
var items = new vis.DataSet([]);
items.add({id: 783, content: '[some text]', start: '2034-07-25 12:00', end: ' 12:00', type: 'point', title: '2034-07-25', group: 'group1'});
items.add({id: 785, content: '[some more text] <br/><a onclick=popUp785.open();>more...</a>', start: '2034-07-26 12:00', end: ' 12:00', type: 'point', title: '[title]', group: 'group1'});
window.addEvent('domready', function() {popUp785 = new PopUpWindow('[title]', { contentDiv: 'timelineDiv785', top: 0, left: 0 }); });
document.write( '<div id=timelineDiv785><em>[the more text]</div>' );
items.add({id: 788, content: '[some text] <br/><a onclick=popUp788.open();>more...</a>', start: '2034-07-28 12:00', end: '2034-08-04 12:00', type: 'range', title: '2034-07-28 :: 2034-08-04', group: 'group2'});
window.addEvent('domready', function() {popUp788 = new PopUpWindow('[title]', { contentDiv: 'timelineDiv788', top: 20, left: 20 }); });
document.write( '<div id=timelineDiv788><em>[more text]</div>' );
var options = { type: 'point', editable: false, multiselect: false, showCurrentTime: false, stack: true, timeAxis: { scale: 'day', step: 1}, start: '2034-07-24', end: '2034-09-22', clickToUse: false, orientation: {axis: 'both'} };
var timeline = new vis.Timeline(container, items, options);
REM: PopUpWindow.js comes from moontools
I also have this issue. I have a template option for events/items displayed in the timeline which contains an <a href="…">…</a>, but I cannot get the link to actually work. The click event is being stolen by something without my knowledge.
Maybe this is caused by the new XSS protection!? See the new xss setting in the docs.
Doesn't seem to be the case (set xss: { disabled: true}), "vis-ltr" still catches the event before