Jump to content
GreenSock

alessio

Mobile scrolling mobile huawei not working !

Recommended Posts

In the site there is a part of horizontal scrolling and when you get in the cabinet the scroll becomes vertical. The scroll does not work on huawei mobile phones. I do not know what the problem is. I put the code I used for the horizontal scroll

 

$(function(){

        var $window = $(window);		

        var scrollTime = 1.2;			
        var scrollDistance = 300;		

        $window.on("mousewheel DOMMouseScroll", function(event){

          event.preventDefault();

          var delta = event.originalEvent.wheelDelta/120 || -event.originalEvent.detail/3;
          var scrollLeft = $window.scrollLeft();
          var finalScroll = scrollLeft - parseInt(delta*scrollDistance);

          TweenMax.to($window, scrollTime, {
            scrollTo : { x: finalScroll, autoKill:true },
              ease: Power1.easeOut,	
              autoKill: true,
              overwrite: 5
            });
        });
      });

 

Link to comment
Share on other sites

I'm pretty sure that code won't work on most phones. Phones typically don't have a mouse wheel. 

 

And mousewheel and DOMMouseScroll are non-standard events. You should probably use wheel instead. Of course that still won't work for mobile.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×