I have a JSON file which has this structure:
{ "short_title":"HB_START_SHORT_TITLE",
"tips{"1":"HB_START_TIPS_1_1","2":"HB_START_TIPS_1_2","3":"HB_START_TIPS_1_3","4":"HB_START_TIPS_1_4"},
},
I would like to print the nested item "tips" as a slider with previous-next buttons.
Therefore I wrote this code in my HTML below:
<ul class="sb-parentlist">
<div data-ng-repeat="parts in data track by $index">
<li>
<div class="sb-open" ng-show="showDetails">
{{parts.short_text|translate}}
<br>
<li><span class="sb-text-title" href="#" ng-click="OpenTips = ! OpenTips"><b>Tips</b></span>
<span ng-show="OpenTips" class="sb-open">
<br>
<div ng-repeat="data in parts.tips track by $index" ng-class="{'tips-hide': $index > $index + 1}">
{{data|translate}}
<br>
<div class="keys">
<button type="button" class="btn btn-pre" ng-click="$index = $index > 1 ? $index - 1 : 1">Previous</button>
<button type="button" class="btn btn-next" ng-click="$index = $index < data.length ? $index + 1 : data.length">Next</button>
</div>
</div>
</span>
</li>
</ul>
</div>
</li>
</div>
</ul>
and the tips-hide class in CSS:
.tips-hide {
left: -100px !important;
opacity: 0 !important;
}
.sb-open {
display: block;
height: auto;
opacity: 1;
transition:all 0.6s ease;
li {
display: block;
}
}
But what I am getting is every element in the list one after the other, with the buttons on the bottom of each one of them.
ScreenShot below: