Skip to content

Commit 5659971

Browse files
author
Valentin Hervieu
committed
feat(ticksTooltip): Add a ticksTooltip option
This feature is similar to the previous ticksValuesTooltip options but for ticks. Closes #209
1 parent 68e9c69 commit 5659971

File tree

9 files changed

+8557
-15
lines changed

9 files changed

+8557
-15
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ $scope.slider = {
232232

233233
**showTicksValues** - _Boolean (defaults to false)_: Set to true to display a tick and the step value for each step of the slider.
234234

235-
**ticksValuesTooltip** - _Function(value) (defaults to null)_: (requires angular-ui bootstrap) Used to display a tooltip when a tick value is hovered. Set to a function that returns the tooltip content for a given value.
235+
**ticksTooltip** - _Function(value) (defaults to null)_: (requires angular-ui bootstrap) Used to display a tooltip when a tick is hovered. Set to a function that returns the tooltip content for a given value.
236+
237+
**ticksValuesTooltip** - _Function(value) (defaults to null)_: Same as `ticksTooltip` but for ticks values.
236238

237239
**scale** - _Number (defaults to 1)_: If you display the slider in an element that uses `transform: scale(0.5)`, set the `scale` value to 2 so that the slider is rendered properly and the events are handled correctly.
238240

demo/demo.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $modal) {
104104
}
105105
};
106106

107+
//Slider with ticks and tooltip
108+
$scope.slider_ticks_tooltip = {
109+
value: 5,
110+
options: {
111+
ceil: 10,
112+
floor: 0,
113+
showTicks: true,
114+
ticksTooltip: function(v) {
115+
return 'Tooltip for ' + v;
116+
}
117+
}
118+
};
119+
107120
//Slider with ticks and values
108121
$scope.slider_ticks_values = {
109122
value: 5,

demo/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>AngularJS Touch Slider</title>
88
<!-- Latest compiled and minified CSS -->
9-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
9+
<link rel="stylesheet" href="./lib/bootstrap.min.css">
1010
<link rel="stylesheet" href="../dist/rzslider.css"/>
1111
<link rel="stylesheet" href="demo.css"/>
1212
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
@@ -97,6 +97,14 @@ <h2>Slider with ticks</h2>
9797
></rzslider>
9898
</article>
9999

100+
<article>
101+
<h2>Slider with ticks and tooltips</h2>
102+
<rzslider
103+
rz-slider-model="slider_ticks_tooltip.value"
104+
rz-slider-options="slider_ticks_tooltip.options"
105+
></rzslider>
106+
</article>
107+
100108
<article>
101109
<h2>Slider with ticks and values (and tooltips)</h2>
102110
<rzslider
@@ -243,7 +251,7 @@ <h2>Slider with all options demo</h2>
243251

244252
</body>
245253
<script src="../node_modules/angular/angular.js"></script>
246-
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.js"></script>
254+
<script src="./lib/ui-bootstrap-tpls.js"></script>
247255
<script src="../dist/rzslider.js"></script>
248256
<script src="demo.js"></script>
249257
</html>

demo/lib/bootstrap.min.css

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)