Jump to content
Search Community

Dragable not working intertia

Fullsix SL test
Moderator Tag

Go to solution Solved by Fullsix SL,

Recommended Posts

Hi,

I just tried to make a simple case of the Draggable/Interia example working and the dragging works but not doing the intertia. I'm a club member and installed the library from npm (using the .npmrc config provided). Here is the relevant code;

 

<style>
    .content{
        height: 100%;
        align-items: center;
        width: 842px;
        outline: 1px solid #e60000;
        padding:0;
    }
    .container{
        outline: 1px solid blue;
        width: 5000px;
        height: 300px;
        background-color: aliceblue;
    }
</style>
<div class="ws10-o-wrapper content">
    <div class="container" data-ws10-js="draggable">
    </div>
</div>

And then the class (it's instantiated internally)

import { gsap } from "gsap";
import { Draggable } from "gsap/Draggable";

const defaults = {
    $element: undefined,
    selectors: {
        elements: `.js-carousel-list-element`,
        list: `.js-carousel-list`,
    },
    classes: {
    },
};
export default class draggable {
    static selector = "draggable";

    constructor(properties = {}) {
        const config = Object.assign({...defaults}, properties)
        this.element = config.$element;
        gsap.registerPlugin(Draggable);
    }
    init() {
        Draggable.create(this.element, {
            type:"x,y",
            edgeResistance: 0.65,
            bounds: this.element.parentNode,
            inertia: true,
            autoScroll: true,
        });
    }
}

I'm creating it in storybook, but tried to isolate the example the much i can. What can i be doing wrong? The code is very basic...ç

Thanks!

 

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.
×
×
  • Create New...