Giter Site home page Giter Site logo

Comments (11)

baptistebriel avatar baptistebriel commented on May 20, 2024 2

Yup, the codepen demo you provided will not work if you try to scroll vertically because it's listening for virtual-scroll's deltaX value.

You could have a look into the native-horizontal demo if you'd like to be able to transform your section on a x-axis while keeping a vertical scrolling behavior, including default browser's scrollbar.

Otherwise, you could listen to virtual-scroll's deltaY instead of deltaX when you're scrolling.
That might be a useful option to add to the library...

In the calc function inside index.js, you can replace this line (106):

const delta = this.vars.direction == 'horizontal' ? e.deltaX : e.deltaY

...with this:

const delta = e.deltaY

Does that makes sense? Let me know if that's what you needed!

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 20, 2024 1

@baptistebriel well it's pretty much exactly as in the demo=). I copied index.js and custom.js to my project, and installed the necessary dependencies for smooth (importing smooth gave me an error saying i cant invoke smooth without "new", but worked when I just copied the index file). The only thing that differs from the demo is that I'm setting the vs-div width in the CSS rather than in the custom.js file, so the style.width,transform,inline block is removed from my custom file.

Pretty much this:

.parent-to-vs-section{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
whitespace: nowrap;
overflow: hidden;
}

.vs-section{
position: absolute;
top: 0;
Left: 0;
width: 100%;
height: 100%;
}

.vs-div{
display: inline-block;
width: 50%;
height: 100%;
}

plus index.js and custom.js from the horizontal demo.

here is a pen with the demo, which also isn't working for me (except when i swipe left on the trackpad). http://codepen.io/ReGGae/full/GWNMPe/

Would be awesome to get this working=)

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 20, 2024

Hi @etiennejcharles,

I just pushed another demo, you can already clone it and try it out!
See commit #395d51f for the details.

This doesn't include a parallax effect inside the elements like on BIA, but I think you can just start with this. If you'd need to do that, it's just basically adding an extra div inside of each items, and applying transforms on it when the parent enters the viewport.

Hope it helps. Cheers!

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 20, 2024

Also trying to do this. Currently trying it by copying the demo, however I can't get the scrolling to work. Looks ok when inspecting.

https://puu.sh/ugxfT/f6c8c0f6b3.png

Is the custom script needed or can I just set the content inside vs-section to 200vw and direction to horizontal?

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 20, 2024

Do I have to do anything more then what is in the custom extend for horizontal? The demo doesn't work for me. (works on build in amsterdam tho, so shouldn't be my hardware).

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 20, 2024

Hey @jesperlandberg, could you send me a demo link with your implementation of horizontal scrolling? I can give it a look.

from smooth-scrolling.

jesperlandberg avatar jesperlandberg commented on May 20, 2024

@baptistebriel

Indeed it does work by changing that line=) Thanks!

from smooth-scrolling.

philipyoungg avatar philipyoungg commented on May 20, 2024

@baptistebriel would love this in native. :)

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 20, 2024

I'll think about adding an extra option to it. Will let you know here when a new version is up!
@etiennejcharles was that what you were looking for as well?

from smooth-scrolling.

philipyoungg avatar philipyoungg commented on May 20, 2024

@baptistebriel I've read the code several times yesterday, and now getting hang of it. Mind if I send you PR for this feature? Would be my first chance to give back to web community!

from smooth-scrolling.

baptistebriel avatar baptistebriel commented on May 20, 2024

@philipyoungg feel free to post a PR if you want, that would be much appreciated!
I guess we could just have an option like this.vars.listenTo = 'x' || 'y' || 'both' or something!

from smooth-scrolling.

Related Issues (20)

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.