The SweetTitle Pattern

Here, we use our SweetTitles pattern, the code for which is within SweetTitles.js. It is not dependent on any libraries.

The following files need including in the head of the document...


    <script src="../Include/Core.js" type="text/javascript"></script>
    <script src="../Include/ssSweetTitle.js" type="text/javascript"></script>
    <link  href="../Include/ssSweetTitle.css" type="text/css" rel="stylesheet"/>
          

For any element with the class "sweettitle", it gives a nice tooltip showing the title of the element.

HTML can be included in the title, it should be constructed with [ and ] rather than < and >


    <span title="[strong]Joe Hart[/strong] is a Goalkeeper" class="sweettitle">
      <a href="#" >1. Joe Hart (England)</a>
    </span></li>
          
  • Note that the line ssAddLoadEvent(initialiseSweetTitle); is run automatically in ssSweetTitle.js. This looks for any element of class sweettitle and attaches this behaviour to them.