Kill Scrollspy on touch?

I thought this would be possible using the Visibility stack, just tick the “Hide On Touch” option. But it does exactly what it says on the tin, it hides everything inside on touch! (I wrongly assumed it’d affect the Scrollspy stack differently).

So, any way to kill the Scrollspy effect on touch without hiding the contents?

@Lucas

I’m afraid there’s no such option for this component, at least it’s not listed in the official docs.

1 Like

No bother, I’ll see if I can work out some css.

For anyone else finding this, if you’ve picked up on the jumping issue with Scrollspy on small, typically, smartphone screens, be sure you’ve not selected slide down as the animation option. I’ve discovered that with “slide-down”, as the animation appears on the screen from the top, it causes mobile screens to “jump” down as the animation appears. Selecting Slide-up fixes this.

If I can work out some css to turn off the effect entirely on mobile, I’ll post back.

1 Like

Put this in site wide JS

var $=jQuery=stacks.jQuery;
$(function() {
	if("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch || false){
  		$('[uk-scrollspy]').removeAttr('uk-scrollspy').css('visibility', 'visible');
	}
});
1 Like