asvd / dragscroll

micro library for drag-n-drop scrolling style
http://asvd.github.io/dragscroll/
MIT License
1.1k stars 166 forks source link

How can I use this package in React project? Thank you #44

Closed scortumee closed 5 years ago

scortumee commented 6 years ago

I tried to import this package like that import dragscroll from 'dragscroll';, and tried to to use it

<div className='dragscroll'>
     Blabla
</div>

However, it is not working. I am new to React, so I don't know what I am doing wrong. Thank you

natterstefan commented 6 years ago

Hi @scortumee,

I have prepared a Codepen to illustrate how to use dragscroll in React: https://codepen.io/natterstefan/pen/LrwWJj. Take a look at Settings -> Javascript to see what I imported.

Basically you have to make sure that dragscroll.js (eg. from a CDN) is part of your html (eg. in the <head> of your index.html and add the dragscroll class to your scroll container.

thinkloop commented 6 years ago

Simply add:import dragscroll from 'dragscroll'; at the top of any component that referenceS the "dragscroll" css selector