Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you sure this will be a good idea?</p> <p>A fade-in effect is often used not only for its soft and 'natural' feeling in the rendering but also because it allows the browser a certain amount of time to <strong>completely</strong> load the image, otherwise the user would experience the ugly 'cascading' effect of a loading image. We can quite safely say this will be the case for hi-res images used for backgrounds, as in your example.</p> <p>Anyways, if you (or your client) still want to give it a try, here's a way to accomplish it.</p> <p>You need to declare a custom animation optimized for the first image only. Something like:</p> <pre><code>@-webkit-keyframes firstImageAnimation { 0% { opacity: 1; } 17% { opacity: 1; } 25% { opacity: 0; } 100% { opacity: 0; } } /* complete with all other vendor prefixes */ </code></pre> <p>Then assign it to the .jpg you want to appear first:</p> <pre><code>.cb-slideshow li:nth-child(1) span { background-image:url(path-to-first-image); -webkit-animation: firstImageAnimation 36s linear infinite 0s; -moz-animation: firstImageAnimation 36s linear infinite 0s; -ms-animation: firstImageAnimation 36s linear infinite 0s; -o-animation: firstImageAnimation 36s linear infinite 0s; animation: firstImageAnimation 36s linear infinite 0s; } </code></pre> <p><em>(This will override the original animation, still assigned to every other background image).</em></p> <p>This way the first image will promptly pop up right after loading the page. Unfortunately after a while you'll notice that this will break the slideshow as that first image will appear all of a sudden right after the very last image fades out.</p> <p>A simple workaround is to assign the same image as <strong>first</strong> and <strong>last</strong> in the slideshow, with the latter defaulting back to the same animation as any other image except the first. So in this case it will simply be something like:</p> <pre><code>.cb-slideshow li:nth-child(6) span { background-image: url(path-to-first-image); -webkit-animation-delay: 30s; -moz-animation-delay: 30s; -ms-animation-delay: 30s; -o-animation-delay: 30s; animation-delay: 30s; </code></pre> <p>}</p> <p>This will translate in a seamless transition from the last to the first image in the set.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload