Ion slides weird behaviour

Hi, when i use a ion slides in my project at the very beginnig it shows only one of the slides and after one or two second it shows the right amount of slides at the same time. As one image worth a million words lets take a look to the next one:

The image above appears for just the first two seconds. After that time the image below appears:

As i have my slides options like {‘autoplay’: false, ‘slidesPerView’: 2.5} it should show the second image right away.

I tought that maybe this is a performance problem, too many things happening at the same time, but after removing almost everything the problem persists.

Can you please provide access to a repository containing a minimal complete reproduction case?

For example if you do this:

import { Component, OnInit } from '@angular/core';

  selector: 'app-home',
  templateUrl: '',
  styleUrls: ['']
export class HomePage implements OnInit {
	private algo;

	constructor() { }

	ngOnInit() {
		this.algo = [{"summary":"They feature Vault Boy, Power Armor and Perk Cards.","title":"                  'Fallout 76' gets glow-in-the-dark postage stamps in the UK and Europe              ","external_article":true,"tags":"av bethesda fallout fallout76 gaming merchandise","thumbnail":"","source":"Engadget","authors":"saqib shah/","url":"","date":"2018-11-08T15:19:02.823Z"},{"summary":" We are almost at the end of the week, let's share one burst of inspiration roundup, calling it: Pure Inspiration. We have our UI Inspiration but this one is more scattered. We are not trying to be focused but sharing a series of images from UI interactions, photography, illustration, graphic design and so on.","title":"Pure Inspiration: A roundup Yi Li, Michal Kmeť and more","external_article":true,"tags":"pure inspiration inspiration digital art","thumbnail":"","source":"Abduzeedo","authors":"François Hoang","url":"","date":"2018-11-08T00:00:00Z"},{"summary":"Black Friday and Cyber Monday are coming for 2018 - here's everything you need to know as a creator, including how to find the best deals on creative tech, design software and more this weekend.","title":"Black Friday 2018: When is it and what artists and designers can expect this year","external_article":true,"tags":"\nNews\n","thumbnail":"","source":"Digital Arts","authors":"Giacomo Lee","url":"","date":"2018-11-08T00:00:00Z"},{"summary":"Harley-Davidson has launched its first electric motorcycle, the LiveWire, which is set to go on sale in 2019.","title":"Harley-Davidson debuts motorcycle \"that just happens to be electric\"","external_article":true,"tags":"Design","thumbnail":"","source":"Dezeen","authors":"Rima Sabina Aouf","url":"","date":"2018-11-08T00:00:00Z"},{"summary":"Can Marketing Save Lives? at the Museum of Brands demonstrates how attitudes have shifted alongside the campaigns designed to change and moderate people’s behaviour","title":"Exhibition reveals evolving public health campaigns on smoking, sexual health and more","external_article":true,"tags":"\nReviews ","thumbnail":"","source":"Design Week","authors":"Alina Polianskaya","url":"","date":"2018-11-07T15:13:45Z"}];


<ion-content padding>
	<ion-slides [options]="{'autoplay': false, 'slidesPerView': 2.5}" scrollbar="true">
		<ion-slide *ngFor="let a of algo">
			<ion-img [src]="a.thumbnail"></ion-img>
			<h1 class="featured-title">{{a.title}}</h1>

It happends for a brief period of time

What I meant is “something where I can type git clone blahblah; cd blahblah; npm i; ionic serve and be able to reproduce the situation”.

Sorry, here you have…

Thanks for taking the time to make that. Unfortunately (?) it builds and looks just fine in my environment. All slides seem to appear as soon as the app starts. Is it possible that the way algo is initialized in this sample app is different from how it is being initialized in the real project?

I just tried the app in “ionic serve -l” and the problem is there but for just a moment, very quickly. But if i run it in a device is longer

Do you think #15519 might be related?

the scrollbar="true" seems to be the problem, if you remove the attribute it works aka your goal is achieved.

not sure if it’s actually an Ionic problem, because if you don’t use the attribute scrollbar bur rather set this in the options object it doesn’t seems to work as you would except neither (or sometimes it works sometimes not)

<ion-slides [options]="{‘autoplay’: false, ‘slidesPerView’: 2.5}" scrollbar=“true” pager=“true”>

try this pager="true"

I don’t think so, it’s a different problem but seems like it’s a little bit broken.

Hi, it doesn’t solve the problem

Hi, even if i remove it doens’t solve the problem

Hi pabloo87
I have the same problem in my Ionic Project. It seems to be the slidesPerView-option.
When the Component with the slides gets active the slidesPerView-option has its default value 1. one moment later ionic overrides it with your value but at first it shows the slides with slidesPerView=1

The only workaround i found is to set the opacity of the slides to 0 and when the slides are fully initialized set the opacity to 1.

I had the same problem and I think finally came across with a possible workaround.
On my html I use:

<ion-slides [slidesPerView]="3">   <---- for example
        <ion-slide *ngFor="s of slides">

Then on your css you could do something like this:

ion-slide    {
            padding-right: 16px;    <----- to separe each ion-slide
            width: calc((ionSlidesVisibleWidthOnScreen) / 3) !important;  <---- to set the number of ion-slides visible

It is important to match the slidesPerView value on the html with the value used on the css to divide the ionSlidesVisibleWidthOnScreen. This way scrolling won’t mess up.

Hope it helps somebody