Ion-segment auto slide to focus selected segment button


#1

Hi, I have a horizontal slide ion-segment, and now my faced problem is that when I select a segment button at the last or the position that i can see it due to the phone width is limit. Can I auto slide to the segment button that I selected then I can see in the phone width range. Thanks.


#2

You could use this if possible for the ion-segment buttons

<ion-scroll  scrollX="true"  >
  -------
  -------
</ion-scroll>

#3

Thank you for your reply. Sorry my english is poor, I mean how can slide to the selected segment button programmatically? Thanks again.


#4

I am also getting this issue. Did you solve this ??


#5

Please add your code snippet, then it would be easy for members to analyse the code and answer your question.


#6

Patient Details Personal Details
                          <ion-segment-button (click)="selectTab(2)"
                          value="2">
                          Employment Details
                          </ion-segment-button>
                          <ion-segment-button (click)="selectTab(3)"
                          value="3">
                          Contact Address
                          </ion-segment-button>
                          <ion-segment-button  (click)="selectTab(4)"
                          value="4">
                          {{test}}
                          </ion-segment-button>
                          <ion-segment-button (click)="selectTab(5)"
                          value="5">
                          Disease Details
                          </ion-segment-button>
                          <ion-segment-button (click)="selectTab(6)"
                          value="6">
                          Admision Details
                          </ion-segment-button>
                          <!-- <div id='indicator' class="SwipedTabs-indicatorSegment" [ngStyle]="{'width.px': (this.tabElementWidth_px)}"></div> -->
                        </ion-segment>

ContentTab 1

ContentTab 2

ContentTab 3

ContentTab 4

ContentTab 5

ContentTab 6

ContentTab 7

if i am sliding the tab the segment button will indicate. but i am sliding fourth tab segemnt button indicate but not scrolling the segment .