patternlab/styleguide/public/styleguide/js/patternlab-viewer.js
function(pos) {
    
    // remove active class
    els = document.querySelectorAll('#sg-annotations > .sg-annotations-list > li');
    for (i = 0; i < els.length; ++i) {
      els[i].classList.remove('active');
    }
    
    // add active class to called element and scroll to it
    for (i = 0; i < els.length; ++i) {
      if ((i+1) == pos) {
        els[i].classList.add('active');
        $('.sg-pattern-extra-info').animate({scrollTop: els[i].offsetTop - 10}, 600);
      }
    }
    
  }
function(pos) {
    
    // remove active class
    els = document.querySelectorAll('#sg-annotations > .sg-annotations-list > li');
    for (i = 0; i < els.length; ++i) {
      els[i].classList.remove('active');
    }
    
    // add active class to called element and scroll to it
    for (i = 0; i < els.length; ++i) {
      if ((i+1) == pos) {
        els[i].classList.add('active');
        $('.sg-pattern-extra-info').animate({scrollTop: els[i].offsetTop - 10}, 600);
      }
    }
    
  }
function ( pos ) { // remove active class els = document . querySelectorAll ( '#sg-annotations > .sg-annotations-list > li' ) ; for ( i = 0 ; i < els . length ; ++ i ) { els [ i ] . classList . remove ( 'active' ) ; } // add active class to called element and scroll to it for ( i = 0 ; i < els . length ; ++ i ) { if ( ( i + 1 ) == pos ) { els [ i ] . classList . add ( 'active' ) ; $ ( '.sg-pattern-extra-info' ) . animate ( { scrollTop : els [ i ] . offsetTop - 10 } , 600 ) ; } } }
slides the modal window to a particular annotation
@param  {Integer}      the number for the element that should be highlighted
slides the modal window to a particular annotation