Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
i20rzslider
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jedife
i20rzslider
Commits
01026c94
Commit
01026c94
authored
Oct 16, 2016
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update demo for logScale and custom scales
parent
169967a5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
0 deletions
+86
-0
demo.js
demo.js
+37
-0
index.html
index.html
+18
-0
slider_custom_scale.js
snippets/slider_custom_scale.js
+22
-0
slider_log.js
snippets/slider_log.js
+9
-0
No files found.
demo.js
View file @
01026c94
...
...
@@ -358,6 +358,43 @@ app.controller('MainCtrl', function ($scope, $rootScope, $timeout, $modal) {
}
};
//Slider config with logarithmic scale
$scope
.
slider_log
=
{
value
:
1
,
options
:
{
floor
:
1
,
ceil
:
100
,
logScale
:
true
,
showTicks
:
true
}
};
//Slider config with custom scale
$scope
.
slider_custom_scale
=
{
value
:
50
,
options
:
{
floor
:
0
,
ceil
:
100
,
step
:
10
,
showTicksValues
:
true
,
customValueToPosition
:
function
(
val
,
minVal
,
maxVal
)
{
val
=
Math
.
sqrt
(
val
);
minVal
=
Math
.
sqrt
(
minVal
);
maxVal
=
Math
.
sqrt
(
maxVal
);
var
range
=
maxVal
-
minVal
;
return
(
val
-
minVal
)
/
range
;
},
customPositionToValue
:
function
(
percent
,
minVal
,
maxVal
)
{
minVal
=
Math
.
sqrt
(
minVal
);
maxVal
=
Math
.
sqrt
(
maxVal
);
var
value
=
percent
*
(
maxVal
-
minVal
)
+
minVal
;
return
Math
.
pow
(
value
,
2
);
}
}
};
//Slider with custom template in order to use HTML formatting for ticks
$scope
.
slider_custom_template
=
{
value
:
100
,
...
...
index.html
View file @
01026c94
...
...
@@ -321,6 +321,24 @@
</tabset>
</article>
<article>
<h2>
Slider with logarithmic scale
</h2>
<rzslider
rz-slider-model=
"slider_log.value"
rz-slider-options=
"slider_log.options"
></rzslider>
<show-code
js-file=
"slider_log"
html-file=
"singleSlider"
></show-code>
</article>
<article>
<h2>
Slider with custom scale
</h2>
<rzslider
rz-slider-model=
"slider_custom_scale.value"
rz-slider-options=
"slider_custom_scale.options"
></rzslider>
<show-code
js-file=
"slider_custom_scale"
html-file=
"singleSlider"
></show-code>
</article>
<article>
<h2>
Slider with angular directive inside custom template
</h2>
<rzslider
...
...
snippets/slider_custom_scale.js
0 → 100644
View file @
01026c94
$scope
.
slider
=
{
value
:
50
,
options
:
{
floor
:
0
,
ceil
:
100
,
step
:
10
,
showTicksValues
:
true
,
customValueToPosition
:
function
(
val
,
minVal
,
maxVal
)
{
val
=
Math
.
sqrt
(
val
);
minVal
=
Math
.
sqrt
(
minVal
);
maxVal
=
Math
.
sqrt
(
maxVal
);
var
range
=
maxVal
-
minVal
;
return
(
val
-
minVal
)
/
range
;
},
customPositionToValue
:
function
(
percent
,
minVal
,
maxVal
)
{
minVal
=
Math
.
sqrt
(
minVal
);
maxVal
=
Math
.
sqrt
(
maxVal
);
var
value
=
percent
*
(
maxVal
-
minVal
)
+
minVal
;
return
Math
.
pow
(
value
,
2
);
}
}
};
snippets/slider_log.js
0 → 100644
View file @
01026c94
$scope
.
slider
=
{
value
:
1
,
options
:
{
floor
:
1
,
ceil
:
100
,
logScale
:
true
,
showTicks
:
true
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment