Skip to main content
ruthg84
Known Participant
November 24, 2016
Question

How do you automatically number the table of contents?

  • November 24, 2016
  • 4 replies
  • 1544 views

I want to automatically number the table of contents in the skin editor. Is it possible to do this? This is so that when I add a new slide, I don't have to manually re-number everything. I want the slide numbers to be visible in the table of contents so that the user can navigate back easily to particular slides when prompted.

Thanks!

    This topic has been closed for replies.

    4 replies

    ruthg84
    ruthg84Author
    Known Participant
    November 27, 2016

    Thanks Paul, this is interesting. However, I don't know how to get to the place where I would insert that code. I always just publish mine and then upload them as Scorms to my LMS.

    Does it still apply if I am working with Scorms?

    Apologies for the lack of knowledge around this!

    Ruth

    Paul Wilson CTDP
    Community Expert
    Community Expert
    November 24, 2016

    No, there is no automatic numbering of the slides in the TOC. However, whatever text you enter into the slide name in the properties panel will end up in your TOC (you may need to refresh it as Lilybiri suggests). If you label your slides to include a number, it will not be automatic but will accomplish the same thing. For example: 

    2016-11-24 5-24-35 PM

    Paul Wilson, CTDP
    ruthg84
    ruthg84Author
    Known Participant
    November 25, 2016

    OK, thanks for clarifying. So I'd still have to go through and change the name on a slide I rearrange. Oh well!

    TLCMediaDesign
    Inspiring
    November 26, 2016

    This code will number the TOC for you automatically for HTML5, you will need to put it in the head section of the index.html. Find <script> and put the code on the next line:

    <script>

    window.addEventListener( 'moduleReadyEvent', function ( e )
    {
    var myText = document.getElementsByClassName('tocText');

    for ( var i = 0; i < myText.length; i++ )
    {
      var getText = myText[ i ].childNodes;
      var str = ( i + 1 ) + ' ' + getText[ 0 ].innerHTML;
      getText[ 0 ].innerHTML = str;
    }
    });

    ruthg84
    ruthg84Author
    Known Participant
    November 24, 2016

    Ah yes. I realise this is possible but I want to retain the titles I have given to each slide in the table of contents, but also for them all to have an automatic number.

    Lilybiri
    Legend
    November 24, 2016

    Same solution. Slide labels do not change when you insert or move slides, only the automatic number is adapted to the new sequence.

    ruthg84
    ruthg84Author
    Known Participant
    November 24, 2016

    But when I press reset, my slide titles are replaced with 'slide 1' etc. I want them to be '1.slide title'. Only, I want the slide titles I give them to stay the same, but the number at the beginning to change. Here is my TOC at the moment:

    I simply want each title to be preceded with its slide number.

    Lilybiri
    Legend
    November 24, 2016

    Bit confused by your question. If you keep the automatic numbering of slides, and refresh the TOC you'll have it there as well. Maybe you missed the Refresh TOC button?