When using a Desktop browser, I have found a javascript code that allows me to vertically fix an element while still enabling horizontal scrolling. The element is repositioned with each scroll event. You can test this out by trying both horizontal and vertical scrolling in this JSFiddle.
var verticallyFixedBox = document.getElementById('verticallyFixedBox');
window.addEventListener('scroll', function() {
verticallyFixedBox.style.top = '' + document.body.scrollTop + 'px';
});
Unfortunately, this method does not work well for mobile browsers. Mobile browsers do not refresh their display until after the drag is complete, resulting in a choppy user experience.
Is there a better approach to vertically fixing an element while still allowing for horizontal scrolling on mobile browsers?