Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved]Anything Slider navigation Re: [Solved]Anything Slider navigation

#120232
Mottie
Member

Include the `onInitialized` callback to add the slide number on startup. In that callback, use `slider.currentPage` instead of `slider.targetPage` (but I really both values are the same on startup) – here is an [updated demo](http://jsfiddle.net/Mottie/ycUB6/3756/).

$(‘#slider’).anythingSlider({
buildNavigation: false,
buildStartStop: false,
onInitialized: function(e, slider) {
$(‘#current’).html(slider.currentPage + ‘/’ + slider.pages);
},
onSlideInit: function (e, slider) {
$(‘#current’).html(slider.targetPage + ‘/’ + slider.pages);
}
});

Then you can re-position the navigation block using absolute positioning. I had to add a wrapper with relative positioning as well. If you don’t understand how they work together check out [this tutorial](http://www.barelyfitz.com/screencast/html-training/css/positioning/).

#wrapper { position: relative; margin: 40px auto; }
#current { position: absolute; left: 50%; top: -20px; margin-left: -150px; }