【问题标题】:Click to toggle function in ngx-carousel not working单击以切换 ngx-carousel 中的功能不起作用
【发布时间】:2018-11-14 21:57:18
【问题描述】:

我已集成 ngx-carousel 以在轮播中显示一些图像。一切都按预期工作,但下面的切换按钮没有按预期工作。

我正在使用来自valor Software 的 ngx-carousel 在网站中,示例运行良好,但在我的项目中,切换按钮不起作用。(buttons image)。

任何人都可以建议我以任何方式使这些按钮起作用。

<carousel selector="slide" [showIndicators]="true" [interval]="myInterval" [(activeSlide)]="activeSlideIndex" >
   <div class="col-md-12 centered">
     <div class="carousel-inner ">
         <slide  class="item animated fadeIn" *ngFor="let offer of currentOffers, let i =index" [ngClass]="{'active':i==0}">
             <blockquote>
                <ng-container >
                    <div class="row">
                         <div class="col-sm-12 align">
                                <img width="100%" src="{{offer.imageName}}">                                                                                
                          </div>
                    </div>
                </ng-container>
             </blockquote>
            </slide>

     </div>
  </div>
</carousel>

【问题讨论】:

  • 请考虑向我们展示您的代码。
  • @JacquesGaudin 我已经添加了我正在使用的 carousal 代码。请你检查一下

标签: javascript angular typescript carousel node-modules


【解决方案1】:

在前辈的帮助下,我得到了完美的解决方案。问题是我为简单的功能编写了太多代码。所以我删除了所有代码并将整个重写为

<carousel [showIndicators]="true" [interval]="myInterval" [(activeSlide)]="activeSlideIndex" >
   <slide class="item animated fadeIn" *ngFor="let offer of currentOffers, let i =index">
      <img [src]="offer.imageName" alt="Offer Image" style="display: block; width: 100%;">
   </slide>
</carousel>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多