-
Notifications
You must be signed in to change notification settings - Fork 57
Drag'n'Drop with mouse events #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
longo-andrea
merged 44 commits into
javascript-tutorial:master
from
pierangelomiceli:017_dnd
Mar 15, 2021
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
3f57493
prima traduzione
pierangelomiceli eea4ef4
ddd
pierangelomiceli 746f03e
aggiunta d
pierangelomiceli 1243f31
traduzione prima stesura articolo
pierangelomiceli af324f3
piccola correzione
pierangelomiceli a449582
fine traduzioni
pierangelomiceli df79aac
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli ebf4f7f
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 9289c34
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli a86f512
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli c4d6b23
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 8a08630
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 45f9315
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/task.md
pierangelomiceli e966ec6
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solut…
pierangelomiceli f0bf086
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 416f5d7
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 911d03d
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 3815da3
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 7d14c96
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 01686c7
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 20645fd
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli fb87202
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 9a018be
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli d9026d0
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 92bcd3f
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/task.md
pierangelomiceli d964d87
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/sourc…
pierangelomiceli 568451f
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/sourc…
pierangelomiceli fb2b312
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/sourc…
pierangelomiceli 25cff19
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 85973b9
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli aa13804
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 6985fe0
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 93fdb7e
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/sourc…
pierangelomiceli 45b8369
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solut…
pierangelomiceli 276d9fe
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solut…
pierangelomiceli 5dcf58d
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solut…
pierangelomiceli 4fc4429
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solut…
pierangelomiceli fb9ebed
Update 2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solut…
pierangelomiceli 0346153
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli e5638d9
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 273b904
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 9131514
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 86933a2
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli 7d7ab04
Update 2-ui/3-event-details/4-mouse-drag-and-drop/article.md
pierangelomiceli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
2-ui/3-event-details/4-mouse-drag-and-drop/1-slider/solution.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
As we can see from HTML/CSS, the slider is a `<div>` with a colored background, that contains a runner -- another `<div>` with `position:relative`. | ||
Come possiamo notare dall'HTML/CSS, lo slider è un `<div>` con sfondo colorato, che contiene un altro `<div>` con `position:relative`. | ||
|
||
To position the runner we use `position:relative`, to provide the coordinates relative to its parent, here it's more convenient here than `position:absolute`. | ||
Per posizionare il cursore useremo `position:relative`, per fornire le coordinate relative al genitore, ed in questo caso è meglio usarlo al posto di `position:absolute`. | ||
|
||
Then we implement horizontal-only Drag'n'Drop with limitation by width. | ||
Quindi andremo a implementare il Drag'n'Drop esclusivamente orizzontale con il vincolo sulla larghezza. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
</div> | ||
|
||
<script> | ||
// ...your code... | ||
// ...il tuo codice... | ||
</script> | ||
|
||
</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
6 changes: 3 additions & 3 deletions
6
2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/solution.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
To drag the element we can use `position:fixed`, it makes coordinates easier to manage. At the end we should switch it back to `position:absolute` to lay the element into the document. | ||
Per trascinare l'elemento possiamo usare `position:fixed`, il quale semplifica la gestione delle coordinate. Alla fine dovremmo tornare ad utilizzare `position:absolute` per posizionare l'elemento all'interno del document. | ||
|
||
When coordinates are at window top/bottom, we use `window.scrollTo` to scroll it. | ||
Se le coordinate sono in alto/basso rispetto alla finestra, useremo `window.scrollTo` per scrollare la pagina fino al punto desiderato. | ||
|
||
More details in the code, in comments. | ||
Maggiori informazioni nel codice, tra i commenti. |
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
2-ui/3-event-details/4-mouse-drag-and-drop/2-drag-heroes/source.view/soccer.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
// Your code | ||
// il tuo codice |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.