Reputation: 1511
I am working on a d3 chart with slider. I would like to increase the length of the slider.
<div id="content">
<br>
<!--<label class ="left" id="lblValue" text-align="left"> Values: </label>-->
<br>
<label for="RAG" text-align="center"> January - December </label>
<br>
<input type="range" name="dataset" value="RAG" in="1" max="12" step="1" onchange="getData" style="margin=0" width="100px"/>
<br>
<span class="tick" style="display:inline-block;width: 4px;text-align:left;margin-right:3px; margin-top=3px;">|<br/>1</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;margin-top=3px;">|<br/>2</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;margin-top=3px;">|<br />3</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;margin-top=3px;">|<br />4</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;margin-top=3px;">|<br />5</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;margin-top=3px">|<br />6</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;margin-top=3px">|<br />7</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;">|<br />8</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;">|<br />9</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;">|<br />10</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;">|<br />11</span>
<span class="tick" style="display:inline-block;width: 4px;text-align:center;margin-right: 3px;">|<br />12</span>
</div>
I have created a fiddle for this: http://jsfiddle.net/ThomsonKrish/KZGd5/1/
Also it would be great if i could align the ticks little bit top so that it displays the ticks immediately below the slider.
Upvotes: 1
Views: 957
Reputation: 739
Width
Instead of using width=""
use the style property to determine the width of the slider.
For example:
<input type="range" name="dataset" value="RAG" in="1" max="12" step="1" onchange="getData" style="margin: 0; width: 200px;"/>
Tick positioning
To change the positioning of the ticks, you can apply a margin-top: -x;
property to the .tick
class via CSS.
Upvotes: 1