I have a DOM structure that looks like this:
In your code $('section') would return you all the sections as a jquery object. Amongst them to get the index of a section which has a class of current you could do this:
sections.index($(".current"));
This would return you a relative index of the section with class current, which would be 4 as
$('sections') would return you a jQuery object Array(0 indexed) which contains all the sections elements. So the element which matches is the 5th element and index would return 4.
Hope this fiddle helps.