apps/gallery/js/gallery.js
// Make the thumbnail for image n visible
Make the thumbnail for image n visible
Make the thumbnail for image n visible
function scrollToShowThumbnail(n) {
  var selector = 'li[data-index="' + n + '"]';
  var thumbnail = thumbnails.querySelector(selector);
  if (thumbnail) {
    var screenTop = thumbnails.scrollTop;
    var screenBottom = screenTop + thumbnails.clientHeight;
    var thumbnailTop = thumbnail.offsetTop;
    var thumbnailBottom = thumbnailTop + thumbnail.offsetHeight;
    var toolbarHeight = 40; 
    screenBottom -= toolbarHeight;
    if (thumbnailTop < screenTop) {            
      thumbnails.scrollTop = thumbnailTop;     
    }
    else if (thumbnailBottom > screenBottom) { 
      thumbnails.scrollTop =                   
        thumbnailBottom - thumbnails.clientHeight + toolbarHeight;
    }
  }
}
function scrollToShowThumbnail ( n ) { var selector = 'li[data-index="' + n + '"]' ; var thumbnail = thumbnails . querySelector ( selector ) ; if ( thumbnail ) { var screenTop = thumbnails . scrollTop ; var screenBottom = screenTop + thumbnails . clientHeight ; var thumbnailTop = thumbnail . offsetTop ; var thumbnailBottom = thumbnailTop + thumbnail . offsetHeight ; var toolbarHeight = 40 ; screenBottom -= toolbarHeight ; if ( thumbnailTop < screenTop ) { thumbnails . scrollTop = thumbnailTop ; } else if ( thumbnailBottom > screenBottom ) { thumbnails . scrollTop = thumbnailBottom - thumbnails . clientHeight + toolbarHeight ; } } }
Make the thumbnail for image n visible
Make the thumbnail for image n visible
// compute this dynamically? // Adjust the screen bottom up to be above the overlaid footer // If thumbnail is above screen // scroll up to show it. // If thumbnail is below screen // scroll  down to show it