slim duration slider - Free Download Slim Custom Duration Slider In jQuery - Slider.js

Free Download Slim Custom Duration Slider In jQuery – Slider.js

Posted on

This time I will share jQuery Plugin and tutorial about Slim Custom Duration Slider In jQuery – Slider.js, hope it will help you in programming stack.

slim duration slider - Free Download Slim Custom Duration Slider In jQuery - Slider.js
File Size: 9.45 KB
Views Total: 1207
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A small jQuery plugin to create a slim, customizable duration slider which can be used as a progress bar to indicate the current/duration time of your audio & video file.

How to use it:

1. Include the main JavaScript Slider.js after jQuery JavaScript library.

1 <script src="/path/to/jquery.min.js"></script>
2 <script src="/path/to/Slider.js"></script>

2. Create a container element to hold the duration slider.

1 <div id="example" class="silder-wrap"></div>

3. Create a new duration slider instance and speicfy the total duration in seconds.

1 let mySlider = new Slider({
2     Duration: 600
3 });

4. Append the duration slider to the container you just created.

1 $('#example').append(mySlider.getSlider());

5. Customize the appearance of the duration slider.

01 let mySlider = new Slider({
02  
03     // width/height of the duration slider
04     width: '600px'
05     height: '3px'
06  
07     // background color
08     backgroundColor: 'lightgrey',
09  
10     // bar color
11     barColor: 'deeppink'
12  
13     // shows drag handler
14     hasBall: true
15  
16     // handler color
17     ballColor: '#29AFFF'
18  
19     // border radius of handler
20     ballRadius: parseFloat(this.height)*1.5
21  
22     // step size
23     scale: 2
24  
25     // always shows the handler
26     alwayShowBall: false
27  
28     // shows current/total duration
29     formatProgress: false
30  
31     // shows indicator
32     hasIndicator: true
33  
34     // background color of indicator
35     indicatorColor: '#778899'
36  
37     // text color
38     indicatorTextColor: 'black'
39      
40 });

6. Get the value as you drag the handler.

01 let mySlider = new Slider({
02  
03     // when dragging
04     valueChanging: function(value){
05       // do something
06     }
07  
08     // after drag
09     valueChanged: function(progress){
10       // do something
11     }
12  
13 });

7. Set the current/total duration time.

1 mySlider.setCurrent(progress);
2 mySlider.setDuration(duration);

This awesome jQuery plugin is developed by mklls. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net