Giter Club home page Giter Club logo

touch-scroll's Issues

getPosition returns NaN

Thanks for implementing the horizontal scrolling I really appreciate it. It works great and I'll be using it in an iPad app I'm currently writing.

When calling the getPosition function currently it returns a NaN. The problem is that an object is being multiplied by -1

i.e. this.getPosition() returns an object {x:0,y:0} and then it is multiplied by -1

getPosition: function() {
var a = [];
this.each(function() {
a.push(-this.getPosition()); <-- problem here
});
return a;
},

I fiddled around with it for a little bit and a simple fix is to get the object first and then multiply each value inside it by -1.

Here's the code:

getPosition: function() {
var a;
this.each(function() {
a = this.getPosition();
a.x = -a.x;
a.y = -a.y;
});
return a;
},

This way when you call:

var position = $('nav').touchScroll('getPosition');

then you can get both the vertical and horizontal values by saying

position.x // for horizontal
position.y // for vertical

Again, thanks for making the horizontal version of this plugin public and hopefully the code above helps make it even better.

Nik

Fix going out of bounds on xoom

On the xoom the scroll is allowed to go way out of bounds and never returns. I'm thinking this is due to xoom not firing webkitTransitionEnd, but I need to look into it further

If that's the case, hopefully I will be able to find a workaround. Like maybe setting an interval that will check for a certain amount of time (the length of the transition) after the user picks up their finger.

add boundary event handler options

Add options to add handlers for when the scroll reaches the top/bottom/left/right since scrollTop/scrollLeft doesn't work with this setup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.