javascript - 如何使轮播的上一个和下一个按钮工作?
问题描述
我有两个不同的部分,我正在使用 *ngfor 循环重复
对于第一部分 Prev 和 Next 正在工作,但对于第二部分 prev 和 next 按钮仅更改第一部分图像而不是第二部分。
这是我使用轮播更改图像的 Prev 和 Next Button 代码:
<div class="d-flex justify-content-center ">
<span (click)="OnPrivClick()" class="targe prevDesable">
<a href="#carouselExampleControls" role="button" data-slide="prev" class="removeline">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<div style="width: 60px;">
<div id="holderpre" style="font-size: 14px; color: #000000; text-align: center;">
<div id="maskpre"></div>
<div id="maskpre"></div>
<div id="mask"></div>
<i class="fa fa-arrow-left preiocon"></i>
<span class="prebutton">PREV</span>
</div>
</div>
</a>
</span>
<span (click)="OnNextClick()" class="addcursor">
<a href="#carouselExampleControls" role="button" data-slide="next" class="removeline">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<div style="width: 133px;">
<div id="holder" style="font-size: 14px;color: #000000;text-align: center;">
<div id="mask2"></div>
<div id="mask1" style="position: absolute;bottom: -2px;left:0px;width:50%;height: 1px;background-color:#ffffff;border: 2px solid white">
</div>
<span class="buttcolor"> NEXT</span>
<i class="fa fa-arrow-right nexticon"></i>
</div>
</div>
</a>
</span>
</div>
</div>
这是图像代码:
<div id="carouselExampleControls" class="carousel slide">
<div class="carousel-inner">
<ng-container *ngFor="let space of xyz && xyz[i]; let j=index">
<div class="carousel-item active underlinecarosel" [ngClass]="{'active':j===0}">
<div class="row">
<div class="col-md-6 col-sm-6 col-12 col-sm-12">
<img [src]="xyz[i][j].attributes.document" class="d-block ">
</div>
</div>
</div>
</ng-container>
</div>
</div>
任何人都可以在我犯错的地方帮助我,以便第二部分的上一个和下一个按钮只会改变第二部分的图像而不是第一部分。
任何潜在客户都会有所帮助
解决方案
推荐阅读
- javascript - 我使用 AngularJS 的 js 文件有问题:“未捕获的错误:[$injector:modulerr]”
- angular - Angular:如何在延迟加载的路由中使用外部模块
- r - 二元运算符错误的非数字参数
- c++ - 如何在每次 QTimer 发射时使用 QLabel
- python - 无服务器部署 - LogicalResourceId
- pyspark - 将 pyspark 行转置为列
- json - 如何在 Angular TypeScript 中忽略 JSON 数据中的变量
- c# - 由于内联,如何不丢失堆栈跟踪中的方法属性?
- reactjs - History.push 在嵌套的子导航栏组件中不起作用
- r - RMarkdown 表格位置