Preview:
הדרכה של תלמידה של ריבקי צ'ולק
לאלמנטים שיוצרים משחק חיבור

מקמי באלמנטור
(או סתם ב HTML)
את האלמנטים שאת רוצה
שהמשתמש יוכל להזיז.
תני לכל אחד מהם במתקדם -> css classes
את הערך – my-draggable
מתחתם הוסיפי אלמנט HTML
ושימי בתוכו את הקוד הבא:
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js"></script>
<script src='https://unpkg.com/gsap@3/dist/Draggable.min.js'></script>
<script>
    gsap.registerPlugin(Draggable);
    Draggable.create(".my-draggable", {
        type: "x,y",
        bounds: ".astericContainer"
    });
</script>
Copy
וזהו
הקסם יתרחש מעצמו…
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter