title: How do I pass the this context into an event handler?
body: <p>I know this question doesn't make much sense, but let me try and clarify a bit.</p>
  
  <p>I have a class, called ScrollBanner, and it looks somewhat as follows (a lot omitted for brevity):</p>
  
  <pre><code>function ScrollBanner() {
      this.initialize = function(selector) {
          $('span#banner1-nav').click(this._onClickNavigation);
      }
  
      this._onClickNavigation = function(event) {
          this.restartTimer(); // this == span#banner1-nav element from this.initialize
          //...
      }
  
      this.restartTimer() {
          //...
      }
  }
  </code></pre>
  
  <p>As you can see <strong>this.initialize</strong> sets a click handler to <strong>this._onClickNavigation</strong>. Some might expect the <strong>this</strong> inside the event handler to refer to the <strong>ScrollBanner</strong> instance, but sadly it doesn't. It refers to the element that trigerred the click event, in this case <strong>span#banner1-nav</strong></p>
  
  <p>What would be the best way to get <strong>this</strong> to refer to the <strong>ScrollBanner</strong> class instance?</p>