Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ You may wonder why it is not possible to access your scope in the card template.

A click on this button would execute the `doSomething()` function in your scope.

When click card you can display the index of the card
## UI
![angular-img](clickcard.png)


## In action

Do you use the `angular-deckgrid` and would like to be featured here? Just send me an [email](mailto:andre.koenig@posteo.de) and I will add you and your application to this list.
Expand Down
34 changes: 34 additions & 0 deletions angular-deckgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,40 @@ angular.module('akoenig.deckgrid').factory('DeckgridDescriptor', [
scope.mother = scope.$parent;

this.$$deckgrid = Deckgrid.create(scope, elem[0]);

//add index when click card start

var index = 0; //create index
var medias = this.$$deckgrid.$$scope.model;
scope.clickCard = function(card){
if(card.card.isselect == true && card.card.isadd ==true){
index -=1;
for (var i = 0, l = medias.length; i < l; i++) {
if(!!medias[i].index && medias[i].index > card.card.index) {
medias[i].index -=1;
}
}
card.card.isadd = false;
}else if(card.card.isadd ==false && card.card.isselect == false){
index +=1;
card.card.isadd = true;
}else if(card.card.isadd == true && !card.card.isselect){
index -=1;
for (var i = 0, l = medias.length; i < l; i++) {
if(!!medias[i].index && medias[i].index > card.card.index) {
medias[i].index -=1;
}
}
card.card.isadd = false;
}else{
index +=1;
card.card.isadd = true;
}
scope.clickMedia(card);
card.card.index = index;
};
//add index when click card end

};

return {
Expand Down
Binary file added clickcard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.