Skip to content

Commit 4791dc1

Browse files
committed
updated
1 parent 61d1655 commit 4791dc1

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

index.html

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
99
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
1010

11-
<script type="text/javascript" src="multiple-selection.js"></script>
11+
<script type="text/javascript" src="multiple-selection.min.js"></script>
1212
<script type="text/javascript">
1313
angular.module('app', ['multipleSelection']);
1414
</script>
1515

1616
<style type="text/css">
1717
.row {
18-
height: 3000px;
1918
width: 100%;
2019
overflow: hidden;
21-
position: absolute;
2220
/* disable selection */
2321

2422
-webkit-touch-callout: none;
@@ -28,13 +26,13 @@
2826
-ms-user-select: none;
2927
user-select: none;
3028
}
31-
.well{
3229

30+
.item_container {
31+
border: 1px solid #ccc;
32+
padding: 10px;
3333
}
34-
.example {
35-
width: 300px;
36-
height: 50px;
37-
background-color: grey;
34+
.item_container div {
35+
width: 33%
3836
}
3937
.select-helper {
4038
position: absolute;
@@ -43,29 +41,32 @@
4341
opacity: 0.2;
4442
}
4543
.selected {
46-
background-color: green;
44+
background-color: green !important;
4745
}
4846
.selecting {
49-
background-color: yellow;
50-
}
51-
.dragging {
52-
background-color: blue;
47+
background-color: yellow !important;
5348
}
5449
</style>
5550
</head>
5651

5752
<body>
58-
<div class="container-fluid" multiple-selection-zone>
59-
<h1>Directives test</h1>
60-
<div class="row">
61-
<div multiple-selection-item class="col-md-3 well" ng-class="{'selecting': isSelecting ,'selected': isSelected, 'dragging': isDragging}" class="example">Just a div</div>
62-
<div multiple-selection-item class="col-md-3 well" ng-class="{'selecting': isSelecting ,'selected': isSelected, 'dragging': isDragging}" class="example">Just a second div</div>
63-
<div multiple-selection-item class="col-md-3 well" ng-class="{'selecting': isSelecting ,'selected': isSelected, 'dragging': isDragging}" class="example">Another one</div>
64-
<div multiple-selection-item class="col-md-3 well" ng-class="{'selecting': isSelecting ,'selected': isSelected}" class="example">Just a last div</div>
53+
<div class="container-fluid">
54+
<h1>Angular Mmultiple Selection Module</h1>
55+
<i>Simple way to make your element selectable</i>
56+
For single selection you can use mouse click. For multiple selection you can use Ctrl + Mouse click or Mouse dragging. Try it`s easy.
57+
58+
<h2>Simple demo</h2>
59+
<div class="row item_container" multiple-selection-zone>
60+
<div multiple-selection-item class="well" ng-class="{'selecting': isSelecting ,'selected': isSelected}">Lorem ipsum dolor sit amet alias, sint magni?</div>
61+
<div multiple-selection-item class="well" ng-class="{'selecting': isSelecting ,'selected': isSelected}">Lorem ipsum dolor sit amet ad mollitia fugiat minima.</div>
62+
<div multiple-selection-item class="well" ng-class="{'selecting': isSelecting ,'selected': isSelected}">Lorem ipsum dolor sit amet autem!</div>
63+
<div multiple-selection-item class="well" ng-class="{'selecting': isSelecting ,'selected': isSelected}">Lorem ipsum dolor sit amet beatae.</div>
64+
<div multiple-selection-item class="well" ng-class="{'selecting': isSelecting ,'selected': isSelected}">Lorem ipsum dolor sit amet. Iure vitae temporibus maiores perspiciatis!</div>
6565
</div>
6666

6767
</div>
6868

69+
6970
</body>
7071

7172
</html>

multiple-selection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ angular.module('multipleSelection', [])
165165
// Check items is selecting
166166
var childs = getSelectableElements(element);
167167
for (var i = 0; i < childs.length; i++) {
168-
if (checkElementHitting(transformBox(offset(childs[i][0]).left, offset(childs[i][0]).top, offset(childs[i][0]).left + childs[i].prop('offsetWidth'), offset(childs[i][0]).top + childs[i].prop('offsetHeight')), transformBox(startX, startY, event.clientX, event.clientY))) {
168+
if (checkElementHitting(transformBox(offset(childs[i][0]).left, offset(childs[i][0]).top, offset(childs[i][0]).left + childs[i].prop('offsetWidth'), offset(childs[i][0]).top + childs[i].prop('offsetHeight')), transformBox(startX, startY, event.pageX, event.pageY))) {
169169
if (childs[i].scope().isSelecting === false) {
170170
childs[i].scope().isSelecting = true;
171171
childs[i].scope().$apply();

multiple-selection.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)