1import sub_navigation from './sub_navigation.js'; 2import scroll_sections from './scroll_sections.js' 3import throttle from './throttle.js'; 4import debounce from './debounce.js'; 5 6var scroll = { 7 8 last_scroll_position: 0, 9 scrolling_down_offset: 50, 10 11 init: function() { 12 13 // var last_scroll_position = 0; 14 // var scrolling_down_offset = 50; 15 $(window).on('scroll', window.galleries.throttle(50, function() { 16 window.galleries.scroll.run(); 17 })); 18 $(window).on('scroll', window.galleries.debounce(200, function() { 19 window.galleries.scroll.run(); 20 })); 21 window.galleries.scroll.run(); 22 23 }, 24 25 run: function() { 26 var scroll_top = $(window).scrollTop(); 27 if (scroll_top > 0) { 28 if (this.last_scroll_position > scroll_top) { 29 if (this.last_scroll_position + 5 > scroll_top) { 30 if (!$('body').hasClass('window-forced-scroll-up')) { 31 if (!$('body').hasClass('page-popup-active') && !$('body').hasClass('overlay-open') && !$('body').hasClass('slide-nav-open')) { 32 $('#container').addClass('scrolling-up'); 33 $('#container').removeClass('scrolling-down'); 34 window.galleries.sub_navigation.enable_page_header(scroll_top, 'up'); 35 } 36 } 37 } 38 } else { 39 if (scroll_top > this.last_scroll_position) { 40 if (scroll_top > this.scrolling_down_offset) { 41 if (!$('body').hasClass('page-popup-active') && !$('body').hasClass('overlay-open') && !$('body').hasClass('slide-nav-open')) { 42 $('#container').removeClass('scrolling-up'); 43 $('#container').addClass('scrolling-down'); 44 window.galleries.sub_navigation.enable_page_header(scroll_top, 'down'); 45 } 46 } 47 } 48 } 49 } else { 50 $('#container').removeClass('scrolling-down scrolling-up'); 51 } 52 if ($('body').hasClass('page-popup-visible')) { 53 $('#container').removeClass('page-top page-top-proximity'); 54 } else { 55 if ($(window).scrollTop() > 40) { 56 if ($('#container').hasClass('page-top')) { 57 $('#container').removeClass('page-top'); 58 } 59 if (!$('#container').hasClass('page-scroll')) { 60 $('#container').addClass('page-scroll'); 61 } 62 if ($('#top_nav #full_nav .top.open').length) { 63 $('#top_nav #full_nav .top.open').removeClass('open'); 64 } 65 } else { 66 if (!$('#container').hasClass('page-top')) { 67 $('#container').addClass('page-top'); 68 } 69 if ($('#container').hasClass('page-scroll')) { 70 $('#container').removeClass('page-scroll'); 71 } 72 } 73 } 74 75 if ($('.record-page-content-combined').length) { 76 window.galleries.scroll_sections.subnav_active_change(); 77 } 78 79 this.last_scroll_position = $(window).scrollTop(); 80 81 } 82 83} 84 85window.galleries = window.galleries || {}; 86window.galleries.scroll = scroll; 87export default scroll;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.