Created
July 16, 2024 01:09
-
-
Save THEFIG06/ffe247a2b48e0b71d05a9d1668f4f332 to your computer and use it in GitHub Desktop.
Draggable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="box green">drag me</div> | |
| <div class="box purple">flick me</div> | |
| <div class="box orange">spin me</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Draggable.create(".green", { bounds: "body" }); | |
| Draggable.create(".purple", { inertia: true, bounds: "body" }); | |
| Draggable.create(".orange", { inertia: true, type: "rotation", bounds: "body" }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/gsap-latest-beta.min.js"></script> | |
| <script src="https://unpkg.com/gsap@3/dist/Draggable.min.js"></script> | |
| <script src="https://assets.codepen.io/16327/InertiaPlugin.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Global styles come from external css https://codepen.io/GreenSock/pen/gOWxmWG */ | |
| body { | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-around; | |
| min-height: 100vh; | |
| margin: 0; | |
| } | |
| .box { | |
| display: block; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| padding: 0.5rem; | |
| color: var(--color-just-black) | |
| } | |
| h1 { | |
| position: fixed; | |
| width: 100%; | |
| text-align: center; | |
| top: 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href="https://codepen.io/GreenSock/pen/gOWxmWG.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment