What I want to achieve is to seek timeline with different slots of data years-li
in a collection of eras decades - ul
.
I have data in this format:
<ul class='decade'>
<p>1810</p>
<li>1811</li>
<li>1813</li>
<li>1819</li>
</ul>
<ul class='decade'>
<p>1820</p>
<li>1822</li>
<li>1824</li>
<li>1828</li>
<li>1829</li>
</ul>
<ul class='decade'>
<p>1830</p>
<li>1834</li>
<li>1835</li>
<li>1836</li>
<li>1837</li>
<li>1838</li>
</ul>
<ul class='decade'>
<p>1840</p>
<li>1844</li>
<li>1849</li>
</ul>
Now each time I am highlighting the respected decade but I want that handler seek in respective to no. years in the decade. for example, if someone selects 1813 then it would be selected and 1810 will be highlighted. At the same time user can navigate only 3 steps in this decade as it is containing only 3 years. same thing should work in 1830 era with 5 steps as it is having 5 years.
Can anyone help in this please?
I have tried so far is: I am not able to calculate the step is it is dynamic in call decade cases.
$('.timelineYearNavList').slider({
min:1,
max:years.length,
step:1,
slide: function( event, ui ) {
//triggering other events
}
});
Please dont assume that I have written only this much code and did not try anything else. :)