Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Problem with scrolling on Mobile device ( Android 6) #172

Open
mm108 opened this issue Mar 6, 2017 · 3 comments
Open

Problem with scrolling on Mobile device ( Android 6) #172

mm108 opened this issue Mar 6, 2017 · 3 comments

Comments

@mm108
Copy link

mm108 commented Mar 6, 2017

Wondering if anyone else had problem with scrolling on Mobile devices? When I scroll (fast ) / Flick , it takes it as a click ( I mean it opens the item ). Is there any setting that I could fiddle with to prevent this from happening? Thanks for the excellent plugin though

@SimonTod
Copy link
Contributor

I am having the same problem, I would love to have a solution

@webportpl
Copy link

I have the same problem. Any tip?

@webportpl
Copy link

I have :)
First you put on header script :)

	var scrolling = false, ts = null;

$('.levelHolderClass ul').on('touchstart.scrollable', function (e) {
if (!scrolling) {
scrolling = true;

  if (e.currentTarget.scrollTop === 0) {
    e.currentTarget.scrollTop = 1;
  } else if (e.currentTarget.scrollHeight === e.currentTarget.scrollTop + e.currentTarget.offsetHeight) {
    e.currentTarget.scrollTop -= 1;
  }
  scrolling = false; 
}
 

ts = e.originalEvent.touches[0].clientY;

});

$('.levelHolderClass ul').on('touchmove.scrollable', function (e) {

var te = e.originalEvent.changedTouches[0].clientY, 
    direction = ts > te ? 'down' : 'up';


$container = $('.levelHolderClass');
$content = $('.levelHolderClass ul');

if ($content.height() <= $container.height()) {

  $('.levelHolderClass ul li').addClass('scrolling').delay(550).queue(function(){
$(this).removeClass("scrolling");
$(this).dequeue();
});

  
} else if ($container.scrollTop() <= 1 && direction == 'up') {

} else if ($container.scrollTop() > 0 && $container.scrollTop() + $container.height() >= $content.height() - 1 && direction == 'down') {

}

});

Second: You change the

onItemClick: function(ev) {

		// First argument is original event object
		var event = arguments[0],
			// Second argument is menu level object containing clicked item (<div> element)
			$menuLevelHolder = arguments[1],
			// Third argument is clicked item (<li> element)
			$item = arguments[2],
			// Fourth argument is instance settings/options object
			options = arguments[3];

		// You can do some cool stuff here before
		// redirecting to href location
		// like logging the event or even
		// adding some parameters to href, etc...

		// Anchor href
		var itemHref = $item.find( "a:first" ).attr( "href" );
		// Redirecting the page

		//location.href = itemHref;
		

		if ($item.hasClass('scrolling')){

		} else {
			location.href = itemHref;
		  }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants