Modern Fancy Time Duration Picker jQuery Plugin – timeBar.js
Here going to introduce a creative jQuery time duration picker jQuery plugin which makes it easy to select a time duration in seconds from a fancy horizontal time bar that gives the selected time with cuepoint feature. It is a timebar where user can set cuepoints at a specific time and get selected time by clicking on cuepoints or timebar.It is useful for video streaming applications where user want to perform any specific task on a particular time interval.

Integrate Time Duration Picker jQuery Plugin
Libraries
Include all the dependent libraries (bootstrap+jQuery) with plugins library.
HTML
Create simple html div where timebar will display.
With custom controls.
Show
Hide
Duration:
JS
Initialize the plugin and specify an array of preset points as follows:
$(document).ready(function () {
const timebar = $("#timelineId").timebar({
totalTimeInSecond: 550,
cuepoints: [0, 110, 220, 330, 440, 550],
width: '1000px',
multiSelect: true,
barClicked(time) {
const selectedTime = timebar.formatTime(time);
$("#duration").text(selectedTime);
},
pointerClicked(time) {
const selectedTime = timebar.formatTime(time);
$("#duration").text(selectedTime);
$('#add-input').val(time);
}
});
});
Here is the list of All default options to customize the time bar.
const timebar = $("#timelineId").timebar({
element: null,
totalTimeInSecond: 0,
cuepoints: [],
width: 0,
globalPageX: 0,
selectedTime: 0,
multiSelect: false,
showCuepoints: true,
});
List of Methods
- addCuepoints : pass time in seconds,func(integer)
- updateSelectedCuepoint: pass new time in seconds,func(integer)
- deleteSelectedCuepoints: func()
- showHideCuepoints : accept value in true or false,func(boolean)
- getSelectedTime : return time in seconds, func
- setSelectedTime: pass time in seconds, func(integer)
- getTotalTime : return total time in seconds, func
- setTotalTime : pass time in seconds , func(integer)
- getWidth : return width ,func()
- setWidth : pass width , func(string)
- getCuepoints : return cuepoints in array, func()
See live demo and download source code.
DEMO | DOWNLOAD
Visit official github repository for more information and follow for future updates. Don’t forget to read license for using this plugin in your projects.