diff --git a/docs/timeline/index.html b/docs/timeline/index.html index 351bb919..edc0f56f 100644 --- a/docs/timeline/index.html +++ b/docs/timeline/index.html @@ -1367,7 +1367,7 @@ document.getElementById('myTimeline').onclick = function (event) { setCustomTimeTitle(title [, id]) none Adjust the title attribute of a custom time bar. - Parameter title is the string to be set as title. Use empty string to hide the title completely. + Parameter title is the string or function to be set as title. Use empty string to hide the title completely. Parameter id is the id of the custom time bar, and is undefined by default. diff --git a/examples/timeline/other/customTimeBarsTooltip.html b/examples/timeline/other/customTimeBarsTooltip.html new file mode 100644 index 00000000..0fe62f36 --- /dev/null +++ b/examples/timeline/other/customTimeBarsTooltip.html @@ -0,0 +1,95 @@ + + + + Timeline | Show current and custom time bars + + + + + + + + + +

+ The Timeline has functions to add multiple custom time bars which can be dragged by the user. +

+

+ + +

+

+ + +

+

+ timechange event, index: , time: +

+

+ timechanged event, index: , time: +


+ +
+ + + + \ No newline at end of file diff --git a/lib/timeline/component/CustomTime.js b/lib/timeline/component/CustomTime.js index 6a94b2ac..6aa6502a 100644 --- a/lib/timeline/component/CustomTime.js +++ b/lib/timeline/component/CustomTime.js @@ -143,6 +143,8 @@ CustomTime.prototype.redraw = function () { if (title === undefined) { title = locale.time + ': ' + this.options.moment(this.customTime).format('dddd, MMMM Do YYYY, H:mm:ss'); title = title.charAt(0).toUpperCase() + title.substring(1); + } else if (typeof title === "function") { + title = title.call(this.customTime); } this.bar.style.left = x + 'px';