add numbering to the menu blocks and the references slider Used in: LIS Hydraulics
$(document).ready(function(){
//add numbering to the menu blocks and the references slider
//needed: ul with class 'counter'
//reset variables
var i = 0;
var total = 0;
$('.subpages-overzicht').find('ul.counter').children('li').each(function(){
//look for the clone of the first li
if( $(this).hasClass('last') && $(this).hasClass('clone') && $(this).not('.begin') ) {
// add extra class
$(this).addClass('begin');
}
//look for the clone of the last item + add extra class
if( $(this).hasClass('clone') && $(this).hasClass('first') && $(this).not('.end') ) {
// add extra class
$(this).addClass('end');
}
//check wheter we should ++ the counter of non-clone list items
if( !$(this).hasClass('clone') && !$(this).hasClass('begin') && !$(this).hasClass('end') ) {
i++;
$(this).prepend('<div class="number">'+i+'</div>');
}
//add numbers to cloned list items
if( $(this).hasClass('.begin') ) { $(this).prepend('<div class="number">1</div>'); }
if( $(this).hasClass('.end') ) {
//set total number
var total = i;
$(this).prepend('<div class="numbertotal">'+total+'</div>');
}
}); //end each function
}); //end document ready function