1// Functions to deal with the button which allows user to scroll to the checkout section on mobile devices when prods have been selected 2document.addEventListener('DOMContentLoaded', function () { 3 const goToCheckoutButton = document.getElementById('go_to_checkout'); 4 const scrollToCheckout = document.getElementById('scroll_to_checkout'); 5 const rightSideSection = document.getElementById('right-side'); 6 7 // Scroll to #right-side when the button is clicked 8 goToCheckoutButton.addEventListener('click', function () { 9 rightSideSection.scrollIntoView({ behavior: 'smooth' }); 10 }); 11 12 // Check if #right-side is visible 13 function isRightSideVisible() { 14 const rect = rightSideSection.getBoundingClientRect(); 15 return rect.top >= 0 && rect.bottom <= window.innerHeight || rect.bottom < window.innerHeight; 16 } 17 18 // Show/hide the button based on #right-side visibility 19 function updateButtonVisibility() { 20 if (items_list.length > 0) { 21 if (isRightSideVisible()) { 22 scrollToCheckout.style.display = 'none'; 23 } else { 24 scrollToCheckout.style.display = 'block'; 25 } 26 } else { 27 scrollToCheckout.style.display = 'none'; 28 } 29 } 30 31 // Update button visibility on scroll and resize 32 window.addEventListener('scroll', updateButtonVisibility); 33 window.addEventListener('resize', updateButtonVisibility); 34 35 // Initial check 36 updateButtonVisibility(); 37});
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.