title: jQuery if/else nested statement
body: <p>Consider the following code, which adds a sticky header on scroll to a page where a certain ID &quot;sticky-header&quot; is present and window size is greater than 425</p>
  <pre><code>    sticky : function() {
          var stickyTools = $j('#sticky-header');
          if (stickyTools.length &gt; 0 &amp;&amp; window.outerWidth &gt; 425) {
              var headerHeight = stickyTools.height();
              var fixmeTop = stickyTools.offset().top + headerHeight - 50;
              $j(window).scroll(function() {
                  var currentScroll = $j(window).scrollTop();
                  if (currentScroll &gt;= fixmeTop) {
                      stickyTools.addClass('sticky');
                  } else {
                      stickyTools.removeClass('sticky');
                  }
              });
          }
      }
  };
  </code></pre>
  <p>Now this works fine on one template but on another template I want to re-use the same functionality but ONLY if a check box is selected. The checkboxes have the class of &quot;item-checkbox&quot;. I have a unique ID on that page which is &quot;template-list&quot;.</p>
  <p>I am unsure of the best way to nest another IF statement within the current one (if (currentScroll &gt;= fixmeTop)) or if there is a more clever way of doing this?</p>