0

here is the code:

<div class="row shochatgroup">
  <div  *ngFor="let message of messages" class="col-auto">
    <button *ngIf="message.state.attributes.shochatpaid > 0 && message.state.attributes.shochatpaid < 5" class="paidshowchat1-4 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 4 && message.state.attributes.shochatpaid < 9" class="paidshochat5-9 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 8 && message.state.attributes.shochatpaid < 20"  class="paidshochat10-19 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 19 && message.state.attributes.shochatpaid < 50" class="paidshochat20-49 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 49 && message.state.attributes.shochatpaid < 99"  class="paidshochat50-99 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 99" class="paidshochat100plus btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
  </div>
</div>

and the css:

.shochatgroup{
  overflow-x: auto;
  white-space: nowrap;
}

yet this is what happensenter image description here

I looked at this stackoverflow post and Im not really understanding what they are doing that I am not: Horizontal scrollable div's in a bootstrap row

1 Answer 1

1

Your code should run fine as seen below, either your .shochatgroup class must be overwritten by some other css and you are losing white-space: nowrap; somewhere, or the buttons are floated.

.shochatgroup{
  overflow-x: auto;
  white-space: nowrap;
}
<div class="row shochatgroup">
  <div  *ngFor="let message of messages" class="col-auto">
    <button *ngIf="message.state.attributes.shochatpaid > 0 && message.state.attributes.shochatpaid < 5" class="paidshowchat1-4 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 4 && message.state.attributes.shochatpaid < 9" class="paidshochat5-9 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 8 && message.state.attributes.shochatpaid < 20"  class="paidshochat10-19 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 19 && message.state.attributes.shochatpaid < 50" class="paidshochat20-49 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 49 && message.state.attributes.shochatpaid < 99"  class="paidshochat50-99 btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
    <button *ngIf="message.state.attributes.shochatpaid > 99" class="paidshochat100plus btn" [ngbTooltip]="message.state.body"  triggers="click:blur">${{message.state.attributes.shochatpaid}}</button>
  </div>
</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.