Skip to content

Commit cb9e413

Browse files
author
Maxime Lafarie
committed
Merge branch 'feature/draggable' of https://github.com/darkomtc11/ngx-smart-modal into darkomtc11-feature/draggable
2 parents 52a7d60 + 75dda4e commit cb9e413

File tree

7 files changed

+11113
-10718
lines changed

7 files changed

+11113
-10718
lines changed

package-lock.json

Lines changed: 11 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/demo/main/main.component.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ <h1 class="title">ngx-smart-modal</h1>
3737
style="position:absolute;top: 300px;left: 900px;">Custom target modal</button>
3838
<button class="button -regular"
3939
(click)="goNewDynamic()">Create dynamic modal<span>new</span></button>
40+
<button class="button -regular"
41+
(click)="draggableModal.open()">Draggable modal<span>new</span></button>
4042
</div>
4143

4244
<h3 class="title">Examples with CSS frameworks</h3>
@@ -343,3 +345,26 @@ <h1>Hey, I am a modal placed relatively to an element!</h1>
343345
<button class="button -dark"
344346
(click)="customTarget.close()">Close</button>
345347
</ngx-smart-modal>
348+
349+
<ngx-smart-modal #draggableModal
350+
[draggable]="true"
351+
[draggableEdges]="true"
352+
identifier="draggableModal">
353+
<h1>Hey, you can drag me anywhere by holding my edges or handle!</h1>
354+
<p>Add class ".draggable" to any element inside modal to make it a drag handle.</p><br>
355+
<span class="draggable">Handle</span>
356+
<span>Not handle</span>
357+
<br><br>
358+
<button class="button -regular" (click)="secondDraggableModal.open()">Second draggable
359+
modal<span>new</span></button>
360+
</ngx-smart-modal>
361+
362+
<ngx-smart-modal #secondDraggableModal
363+
[draggable]="true"
364+
identifier="secondDraggableModal">
365+
<h1>Hey, I will move independently from my parent!</h1>
366+
<p>I can only be moved by a handle.</p><br>
367+
<span class="draggable">Handle</span>
368+
<span>Not handle</span>
369+
<br><br>
370+
</ngx-smart-modal>

src/app/demo/main/main.component.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@
2929
}
3030
}
3131
}
32+
33+
span.draggable {
34+
color: white;
35+
padding: 5px;
36+
text-align: center;
37+
background-color: gray;
38+
margin-right: 10px;
39+
}

0 commit comments

Comments
 (0)