Forum Discussion

PeterSorenson-7's avatar
PeterSorenson-7
Community Member
5 years ago

Two Line Title

You want TWO LINES for your Course Title?

  1. In your player Add your Title text with a pipe inbetween the first and second line - like this: First Line | Second Line

  2. In the Slide Master (master slide) add a slide trigger to execute javascript when the timeline starts on this slide. Add THIS script into the text box:

    //this looks for elements on the player
    var bob = document.getElementsByClassName("view-content");

    //this loops thru all of the returned elements
    //to find the element that contains the class
    for (var i = 0; i < bob.length; i++) {

    //if it finds a match
    if ( bob[i].parentElement.classList.contains( "cs-title" )) {

    if( bob[i].textContent.indexOf( "|" ) != -1){

    var lineArray = bob[i].textContent.split("|");
    var line1 = lineArray[0].trim();
    var line2 = lineArray[1].trim();

    bob[i].textContent = line1;
    bob[i].innerHTML += '<br/>' + line2;
    bob[i].style.textAlign = "left";

    }

    //then we break out of the loop
    break;
    }
    }

    Publish as usual and view. You will have two lines instead of one.

2 Replies

  • I only have SL3.

    Alas, this trick doesn't quite work in that Classic Player. The JavaScript does apparently add a line break at the pipe. But only the first line of the title appears: 

    I assume those with SL360 and the Modern Player will have more luck.  :-)

  • BJacobs's avatar
    BJacobs
    Community Member

    This works great, Peter.  Now for another option.  How would we code to put a scene and page title in that location?  I can do it using the scene number and slide variables, but, as I mentioned in a previous post, it takes up real estate.