I have found a similar question asked here: Add tick marks to jQuery slider?
But this deals with the jQuery-UI library and not jQuery Mobile, I'm not sure how well it would crossover.
What I would like to do is to add 5 tick marks along the slider rail of my jQuery Mobile slider widgets- @ 0%, 25%, 50 %, 75%, 100%
How would I go about doing this?
Edit:
I have implemented Sia's solution but now there are some weird line thickness issues I am noticing.
Here is a picture of my sliders with the ticks via Sia's solution:
As you can see, some of the ticks have varying thickness and they seem to repeat in this way for each slider... The css and html for these ticks is exactly the same as Sia's answer save for the inclusion of numbers below the ticks
Here is the relevant JS code:
$(document).on("pageinit",function(){
var ticks2 = "<div class='tick' id='ticka'></div>"
ticks2 += "<div class='tick' id='tickb'></div>";
ticks2 += "<div class='tick' id='tickc'></div>";
ticks2 += "<div class='tick' id='tickd'></div>";
ticks2 += "<div class='tick' id='ticke'></div>";
ticks2 += "<div class='tick' id='tickf'></div>";
ticks2 += "<div class='tick' id='tickg'></div>";
ticks2 += "<div class='tick' id='tickh'></div>";
$("div.ui-slider-track").append(ticks2);
...
}
And the CSS:
.tick {
width: 1px;
background-color:#3388cc;
height:100%;
position:absolute;
bottom:0px;
}
#ticka{
margin-left:11.1%;
}
#tickb{
margin-left:22.2%;
}
#tickc{
margin-left:33.3%;
}
#tickd{
margin-left:44.4%;
}
#ticke{
margin-left:55.5%;
}
#tickf{
margin-left:66.6%;
}
#tickg{
margin-left:77.7%;
}
#tickh{
margin-left:88.8%;
}