0.0.28-s20 • Published 2 years ago
@nomorejalapenos/draggable v0.0.28-s20
import { draggable } from '@nomorejalapenos/draggable'
const container = document.createElement('div')
const target = document.createElement('div')
container.style.cssText = `
position: absolute;
top: calc(50% - 20vmin);
left: calc(50% - 30vmin);
width: 60vmin;
height: 40vmin;
background-color: lightblue;
touch-action: none;
`
target.style.cssText = `
width: 10vmin;
height: 10vmin;
background-color: tomato;
`
container.appendChild(target)
document.body.appendChild(container)
draggable({
target,
container,
smoothness: 7,
})
import { draggable } from '@nomorejalapenos/draggable'
const el = document.createElement('div')
el.style.cssText = `
position: absolute;
left: calc(50vw - 10vmin);
top: calc(50vh - 10vmin);
width: 20vmin;
height: 20vmin;
background-color: tomato;
`
document.body.appendChild(el)
document.body.style.cssText = `
touch-action: none;
overflow: hidden;
`
draggable({
target: el,
smoothness: 7,
restore: true,
handle: {
tick: (state) => {
el.style.transform = `
${state.transformString}
scale(
${1 + Math.abs(state.track.x.progress.current)}
)
rotate(
${state.track.x.progress.current * 0.5}rad
)
`
},
},
})
Use the CSS property touch-action
for the container
on touch devices to disable the default behavior completely or partially
0.0.20-s14
2 years ago
0.0.16-s11
2 years ago
0.0.27-s20
2 years ago
0.0.16-s10
2 years ago
0.0.25-s16
2 years ago
0.0.24-s15
2 years ago
0.0.15-s10
2 years ago
0.0.14-s10
2 years ago
0.0.27-s17
2 years ago
0.0.18-s12
2 years ago
0.0.27-s18
2 years ago
0.0.27-s19
2 years ago
0.0.23-s15
2 years ago
0.0.22-s14
2 years ago
0.0.19-s12
2 years ago
0.0.19-s13
2 years ago
0.0.17-s11
2 years ago
0.0.13-s9
2 years ago
0.0.13-s10
2 years ago
0.0.21-s14
2 years ago
0.0.26-s17
2 years ago
0.0.28-s20
2 years ago
0.0.12-s9
2 years ago
0.0.12-s8
2 years ago
0.0.12-s7
2 years ago
0.0.111-s7
2 years ago
0.0.11-s7
2 years ago
0.0.1-s7
2 years ago
0.0.1-s6
2 years ago
0.0.1-s5
2 years ago
0.0.1-s4
2 years ago
0.0.1-s2
2 years ago
0.0.1-s1
2 years ago
0.0.1
2 years ago