|
40 | 40 | zoom: 1; |
41 | 41 | } |
42 | 42 |
|
43 | | -.imageset--multiple-ratios .imageset__element { |
44 | | - /* Prevent flash of a skewed image after ratio has |
45 | | - changed, but new image was not loaded yet. |
46 | | - Not supported in IE & EDGE <= 14 */ |
47 | | - object-fit: cover; |
48 | | -} |
49 | | - |
50 | 43 | .imageset__ratio-fill { |
51 | 44 | display: block; |
52 | 45 | overflow: hidden; |
|
58 | 51 | width: 100%; |
59 | 52 | } |
60 | 53 |
|
61 | | -.js .imageset--ratio.imageset--lazyload .imageset__element { |
| 54 | +.imageset--ratio .imageset__element { |
| 55 | + z-index: 2; |
| 56 | +} |
| 57 | + |
| 58 | +.imageset-js .imageset--ratio.imageset--lazyload .imageset__element { |
62 | 59 | /* The actual image is kept behind the placeholder. |
63 | 60 | Rather than fading in the image, the placeholder is |
64 | 61 | faded out instead. This prevents the image layer to |
|
70 | 67 | z-index: 1; |
71 | 68 | } |
72 | 69 |
|
| 70 | +.imageset-js .imageset--alpha.imageset--lazyload .imageset__element { |
| 71 | + /* Images with transparency require a different fading |
| 72 | + technique, as the placeholder would shine through, |
| 73 | + after the final image was loaded. */ |
| 74 | + opacity: 0; |
| 75 | + will-change: opacity; |
| 76 | + transition: opacity 0.5s; |
| 77 | +} |
| 78 | + |
| 79 | +.imageset-js .imageset--alpha.imageset--lazyload.imageset--loaded .imageset__element { |
| 80 | + opacity: 1; |
| 81 | + will-change: auto; |
| 82 | +} |
| 83 | + |
73 | 84 | .imageset__placeholder { |
74 | 85 | display: block; |
75 | 86 | position: absolute; |
76 | | - top: 0; |
77 | | - left: 0; |
78 | | - width: 100%; |
79 | | - height: 100%; |
| 87 | + z-index: 1; |
| 88 | + top: 50%; |
| 89 | + left: 50%; |
| 90 | + width: 101%; |
| 91 | + height: 101%; |
80 | 92 | max-width: none !important; |
| 93 | + transform: translate(-50%, -50%); |
81 | 94 | overflow: hidden; |
82 | 95 | contain: strict; |
83 | | - object-fit: cover; |
84 | | - object-position: 50% 50%; |
85 | 96 | } |
86 | 97 |
|
87 | | -.js .imageset--lazyload .imageset__placeholder { |
| 98 | +.imageset-js .imageset--lazyload .imageset__placeholder { |
88 | 99 | /* Placeholder will be placed on top of the actual |
89 | 100 | image element. This will only be applied, when |
90 | 101 | JavaScript is enabled. */ |
|
106 | 117 | background-color: #efefef; |
107 | 118 | } |
108 | 119 |
|
| 120 | +.imageset--alpha .imageset__placeholder { |
| 121 | + visibility: hidden; |
| 122 | +} |
| 123 | + |
| 124 | +.imageset-js .imageset--alpha .imageset__placeholder { |
| 125 | + visibility: visible; |
| 126 | + transition: opacity 0.5s 0.05s, visibility 0s 0.8s; |
| 127 | +} |
| 128 | + |
| 129 | +.imageset-js .imageset--alpha:not(.imageset--placeholder--color) .imageset__placeholder { |
| 130 | + background-color: transparent; |
| 131 | +} |
| 132 | + |
109 | 133 | .imageset--placeholder--mosaic .imageset__placeholder { |
110 | 134 | /* autoprefixer: off */ |
111 | 135 | /* Mosaic placeholders should render crisp! */ |
|
123 | 147 | /* Opera 26+, Chrome */ |
124 | 148 | } |
125 | 149 |
|
126 | | -.js .imageset--loaded .imageset__placeholder { |
| 150 | +.imageset-js .imageset--loaded .imageset__placeholder { |
127 | 151 | /* After image is loaded, the placeholder will fade out |
128 | 152 | and then change visibility to allow mouse interation |
129 | 153 | with the loaded image in browsers, where the |
|
0 commit comments