1(function ($, window, document) { 2 const BUTTON_ELEMENT = '[data-scroll-to-top]'; 3 4 const ScrollToTop = { 5 init() { 6 this.cacheElements(); 7 this.topbarHeight = parseInt(this.$topbar.height(), 10); 8 9 if (this.$button.length) { 10 this.bindEvents(); 11 } 12 }, 13 cacheElements() { 14 this.$window = $(window); 15 this.$topbar = $('[data-topbar]'); 16 this.$button = $(BUTTON_ELEMENT); 17 }, 18 bindEvents() { 19 this.$window.on('scroll', this.handleScroll.bind(this)); 20 $(document).on('click', BUTTON_ELEMENT, this.handleClick); 21 }, 22 handleClick() { 23 $('html, body').animate({ scrollTop: 0 }, 1000); 24 return false; 25 }, 26 handleScroll() { 27 const scrolled = this.$window.scrollTop(); 28 29 if (scrolled > this.topbarHeight) { 30 this.$button.addClass(LotusConfig.css.activeClass); 31 } else { 32 this.$button.removeClass(LotusConfig.css.activeClass); 33 } 34 }, 35 }; 36 37 $(() => { 38 ScrollToTop.init(); 39 }); 40}(jQuery, window, document));
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.