glide icon indicating copy to clipboard operation
glide copied to clipboard

Fade Transition

Open ghost opened this issue 5 years ago • 16 comments

I'm hoping that a discussion could be opened up about adding Fade back into the transitions for Glide. It sounds like it was available in v2, I'm confused as to why it was removed from v3. I enjoy Glide for its simplicity and easy setup, but this seems like a necessary feature to include. Originally brought up in #32

ghost avatar Jun 06 '19 14:06 ghost

I know there is currently no fade option available in this awesome plugin..., but with a little CSS you can get the fade behavior:

`.glide__slides { transform: translate3d(0,0,0)!important; width: 100vw!important; height: 100vh; } .glide__slide { opacity: 0; z-index: 0; position: absolute; top: 0; left: 0; transition: opacity .4s ease; height: 100vh; }

.glide__slide.glide__slide--active { opacity: 1; z-index: 1; } `

This disabled the transform3d on the .glide__slides that would normally be going on. The .glide__slide divs get position: absolute, top and left 0 to stack them on top of each other. The opacity is 0 for al slides, except for the active one. Therefore only the active slide will be visible.

Note the 100vh on the .glide__slides. Because in the example above the individual slides get a 100vh, the .glide__slides need to get this value as well.

Hope this helps.

freekwevers avatar Jun 11 '19 11:06 freekwevers

It all seems so easy once its written out for you! Thanks that was exactly what I'm looking for

ghost avatar Jun 11 '19 12:06 ghost

vote to re-open. this solution only works if you have a single slide showing at a time

jameelmoses avatar Aug 06 '19 16:08 jameelmoses

Would love to see fade added back in

CorySchulz avatar Aug 12 '19 01:08 CorySchulz

I would too, I wonder how hard it would be to make your own plugin for it? I'm thinking you would need to extend the transform module or create your own...

ghost avatar Aug 12 '19 12:08 ghost

I vote to re-open this too, should get some options

Tam2 avatar Aug 15 '19 15:08 Tam2

The "solution" I mentioned was just a dirty workaround for the single slide use case, because the fade option is currently not available in glide. I would love to get this out of the box to...

freekwevers avatar Aug 15 '19 18:08 freekwevers

I agree, I'll open it up again, but I wonder if anyone here is willing to take on the task? I'm not super familiar with the way this slider is built, but I took a swing at it and didn't get very far.

ghost avatar Aug 26 '19 12:08 ghost

+1

MarkHTML avatar Sep 02 '19 11:09 MarkHTML

For anyone interested, I simplified the CSS for fading from @freekwevers post (above).

position: absolute on every slide and height: 100vh on glide__slides was messing with my layout.

.glide__slides {
    // important needed because this is set using the style attribute
    transform: translate3d(0, 0, 0) !important;
}

.glide__slide {
    position: absolute;
    top: 0;
    left: 0;
    order: 2;
    opacity: 0;
    transition: opacity 1250ms ease-in-out;
}

.glide__slide.glide__slide--active {
    position: relative;
    order: 1;
    opacity: 1;
    z-index: 1;
}

willdavidow avatar Nov 16 '19 19:11 willdavidow

The above solutions did not work well for me. I was able to achieve a fade in/out transition (for my slider that only shows one slide at a time) very easily with just this CSS:

// this prevents the usual sliding transition effect from being visible:
.glide__slides {
  transition: none !important;
}

// and this creates the fade in/out effect of the slides:
.glide__slides li {
  opacity: 0;
  transition: all 700ms ease-in-out;
}
li.glide__slide--active {
  opacity: 1;
}

ary-ana avatar Mar 25 '20 02:03 ary-ana

Anyone gets fade effect for multiple slides visible at once?

morawcik avatar May 02 '21 11:05 morawcik

Would also like to know how to get a fade effect for multiple slides visible at once.

julie-impuls avatar May 05 '21 12:05 julie-impuls

The above solutions did not work well for me. I was able to achieve a fade in/out transition (for my slider that only shows one slide at a time) very easily with just this CSS:

// this prevents the usual sliding transition effect from being visible:
.glide__slides {
  transition: none !important;
}

// and this creates the fade in/out effect of the slides:
.glide__slides li {
  opacity: 0;
  transition: all 700ms ease-in-out;
}
li.glide__slide--active {
  opacity: 1;
}

Beautifully done, simple with much less css then the other examples and this is the only one that worked for me. much appreciated.

lano-vargas avatar Jul 08 '22 10:07 lano-vargas

For anyone interested, I simplified the CSS for fading from @freekwevers post (above).

position: absolute on every slide and height: 100vh on glide__slides was messing with my layout.

.glide__slides {
    // important needed because this is set using the style attribute
    transform: translate3d(0, 0, 0) !important;
}

.glide__slide {
    position: absolute;
    top: 0;
    left: 0;
    order: 2;
    opacity: 0;
    transition: opacity 1250ms ease-in-out;
}

.glide__slide.glide__slide--active {
    position: relative;
    order: 1;
    opacity: 1;
    z-index: 1;
}

And set animationDuration property to 0

7rocs avatar Aug 23 '22 23:08 7rocs

@7rocs That worked well for me, thank you. I added rewindDuration: 0 into params too.

gitVasile avatar Jun 01 '23 13:06 gitVasile