I have a stack of Divs. I can navigate them with my two buttons (Show next or previous card ) by clicking. Thanks dfsq for helping me this far. But I am trying to add keyboard action side by side with mouse click.
Currently Clicking "Next" button shows next item and "previous" shows previous item(if any). Plunker
How I can add something like pressing keyboard "Right arrow" will do same as clicking Next button and pressing keyboard "Left arrow" will do same as clicking previous button.
I search how to do this but nothing effective I got yet. I see This which is kind of what I was expecting but didn't get how I can implement.
Any Solution / suggestions / Examples will be highly appreciated
<div class="container">
<div class="col-md-2-4"
ng-class="{'card-hide': index > $index + 1}"
ng-repeat="card in cards"
ng-style="{left: 2 * $index + 'px', top: 2 * $index + 'px', 'z-index': (cards.length - $index)}">
<ul class="list-unstyled cs-tag-item-grp">
<li class="clearfix" ng-repeat="value in card.cardItem">
<div class="pull-left">
{{value.keys}}
</div>
</li>
</ul>
</div>
<div class="keys">
<button type="button" class="btn btn-next" ng-click="index = index < cards.length ? index + 1 : cards.length">Next</button>
<button type="button" class="btn btn-pre" ng-click="index = index > 1 ? index - 1 : 1">Previous</button>
{{index}}
</div>
</div>