form-01--form-container.php
3 years ago
form-02--form-fields.php
3 years ago
form-03--input.php
5 months ago
form-04--select2.php
5 months ago
form-05--select2-dropdown.php
3 years ago
form-06--timepicker-dropdown.php
3 years ago
form-07--radio.php
5 months ago
form-08--checkbox.php
5 months ago
form-09--calendar.php
3 years ago
form-10--submit.php
5 months ago
form-11--options-container.php
3 years ago
form-12--options-title.php
5 months ago
form-13--gdpr.php
5 months ago
form-14--error-message.php
5 months ago
form-15--success-message.php
2 years ago
form-16--recaptcha.php
5 months ago
general-01--module-container.php
3 years ago
general-02--main-layout.php
1 month ago
general-03--layout-header.php
3 years ago
general-04--layout-content.php
3 years ago
general-05--layout-footer.php
3 years ago
general-06--image-size.php
5 months ago
general-07--image-fitting.php
3 years ago
general-08--image-position.php
5 months ago
general-09--content-wrapper.php
3 years ago
general-10--title.php
5 months ago
general-11--subtitle.php
5 months ago
general-12--content.php
5 months ago
general-13--cta-container.php
3 years ago
general-14--cta-button.php
5 months ago
general-15--cta-alignment.php
3 years ago
general-16--nsa-link.php
5 months ago
general-17--close-button.php
3 years ago
general-18--popup-mask.php
3 years ago
general-19--cta-helper-text.php
5 months ago
module-size-embed.php
5 months ago
module-size-popup.php
5 months ago
module-size-slidein.php
3 years ago
general-07--image-fitting.php
352 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Feature Image Fitting. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | $container = '.hustle-layout .hustle-image'; |
| 10 | $component = $container . ' img'; |
| 11 | |
| 12 | // CONDITIONALS: Check if module has mobile appearance settings enabled. |
| 13 | $is_mobile_enabled = ( '1' === $design['enable_mobile_settings'] ); |
| 14 | $is_mobile_disabled = ( '1' !== $design['enable_mobile_settings'] ); |
| 15 | |
| 16 | // SETTINGS: Image. |
| 17 | $image = $content['feature_image']; |
| 18 | |
| 19 | // SETTINGS: Fitting. |
| 20 | $fitting = $design['feature_image_fit']; |
| 21 | $mobile_fitting = ( $is_mobile_enabled ) ? $design['feature_image_fit_mobile'] : $fitting; |
| 22 | |
| 23 | // ================================================== |
| 24 | // Check if feature image exists. |
| 25 | if ( '' !== $image ) { |
| 26 | |
| 27 | if ( $is_mobile_enabled ) { |
| 28 | |
| 29 | // FITTING: Fill. |
| 30 | if ( 'fill' === $mobile_fitting ) { |
| 31 | $style .= ''; |
| 32 | $style .= $prefix_mobile . $component . ' {'; |
| 33 | $style .= 'width: 100%;'; |
| 34 | $style .= 'max-width: unset;'; |
| 35 | $style .= 'height: 100%;'; |
| 36 | $style .= 'display: block;'; |
| 37 | $style .= 'position: absolute;'; |
| 38 | $style .= 'object-fit: fill;'; |
| 39 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 40 | $style .= '}'; |
| 41 | $style .= ''; |
| 42 | $style .= $support_ie . ' {'; |
| 43 | $style .= $prefix_mobile . $component . ' {'; |
| 44 | $style .= 'width: 100%;'; |
| 45 | $style .= 'max-width: unset;'; |
| 46 | $style .= 'height: 100%;'; |
| 47 | $style .= 'max-height: unset;'; |
| 48 | $style .= '}'; |
| 49 | $style .= '}'; |
| 50 | } |
| 51 | |
| 52 | if ( 'fill' === $fitting ) { |
| 53 | $style .= $breakpoint . ' {'; |
| 54 | $style .= $prefix_desktop . $component . ' {'; |
| 55 | $style .= 'width: 100%;'; |
| 56 | $style .= 'max-width: unset;'; |
| 57 | $style .= 'height: 100%;'; |
| 58 | $style .= 'display: block;'; |
| 59 | $style .= 'position: absolute;'; |
| 60 | $style .= 'object-fit: fill;'; |
| 61 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 62 | $style .= '}'; |
| 63 | $style .= '}'; |
| 64 | $style .= $breakpoint_ie . ' {'; |
| 65 | $style .= $prefix_desktop . $component . ' {'; |
| 66 | $style .= 'width: 100%;'; |
| 67 | $style .= 'max-width: unset;'; |
| 68 | $style .= 'height: 100%;'; |
| 69 | $style .= 'max-height: unset;'; |
| 70 | $style .= '}'; |
| 71 | $style .= '}'; |
| 72 | |
| 73 | if ( 'none' === $mobile_fitting ) { |
| 74 | $style .= $prefix_mobile . $container . ' {'; |
| 75 | $style .= 'display: block;'; |
| 76 | $style .= '}'; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | // FITTING: Contain. |
| 81 | if ( 'contain' === $mobile_fitting ) { |
| 82 | $style .= ''; |
| 83 | $style .= $prefix_mobile . $component . ' {'; |
| 84 | $style .= 'width: 100%;'; |
| 85 | $style .= 'max-width: unset;'; |
| 86 | $style .= 'height: 100%;'; |
| 87 | $style .= 'display: block;'; |
| 88 | $style .= 'position: absolute;'; |
| 89 | $style .= 'object-fit: contain;'; |
| 90 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 91 | $style .= '}'; |
| 92 | $style .= ''; |
| 93 | $style .= $support_ie . ' {'; |
| 94 | $style .= $prefix_mobile . $component . ' {'; |
| 95 | $style .= 'width: auto;'; |
| 96 | $style .= 'max-width: 100%;'; |
| 97 | $style .= 'height: auto;'; |
| 98 | $style .= 'max-height: 100%;'; |
| 99 | $style .= '}'; |
| 100 | $style .= '}'; |
| 101 | } |
| 102 | |
| 103 | if ( 'contain' === $fitting ) { |
| 104 | $style .= $breakpoint . ' {'; |
| 105 | $style .= $prefix_desktop . $component . ' {'; |
| 106 | $style .= 'width: 100%;'; |
| 107 | $style .= 'max-width: unset;'; |
| 108 | $style .= 'height: 100%;'; |
| 109 | $style .= 'display: block;'; |
| 110 | $style .= 'position: absolute;'; |
| 111 | $style .= 'object-fit: contain;'; |
| 112 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 113 | $style .= '}'; |
| 114 | $style .= '}'; |
| 115 | $style .= $breakpoint_ie . ' {'; |
| 116 | $style .= $prefix_desktop . $component . ' {'; |
| 117 | $style .= 'width: auto;'; |
| 118 | $style .= 'max-width: 100%;'; |
| 119 | $style .= 'height: auto;'; |
| 120 | $style .= 'max-height: 100%;'; |
| 121 | $style .= '}'; |
| 122 | $style .= '}'; |
| 123 | |
| 124 | if ( 'none' === $mobile_fitting ) { |
| 125 | $style .= $prefix_mobile . $container . ' {'; |
| 126 | $style .= 'display: block;'; |
| 127 | $style .= '}'; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | // FITTING: Cover. |
| 132 | if ( 'cover' === $mobile_fitting ) { |
| 133 | $style .= ''; |
| 134 | $style .= $prefix_mobile . $component . ' {'; |
| 135 | $style .= 'width: 100%;'; |
| 136 | $style .= 'max-width: unset;'; |
| 137 | $style .= 'height: 100%;'; |
| 138 | $style .= 'display: block;'; |
| 139 | $style .= 'position: absolute;'; |
| 140 | $style .= 'object-fit: cover;'; |
| 141 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 142 | $style .= '}'; |
| 143 | $style .= ''; |
| 144 | $style .= $support_ie . ' {'; |
| 145 | $style .= $prefix_mobile . $component . ' {'; |
| 146 | $style .= 'width: auto;'; |
| 147 | $style .= 'max-width: unset;'; |
| 148 | $style .= 'height: auto;'; |
| 149 | $style .= 'max-height: unset;'; |
| 150 | $style .= '}'; |
| 151 | $style .= '}'; |
| 152 | } |
| 153 | |
| 154 | if ( 'cover' === $fitting ) { |
| 155 | $style .= $breakpoint . ' {'; |
| 156 | $style .= $prefix_desktop . $component . ' {'; |
| 157 | $style .= 'width: 100%;'; |
| 158 | $style .= 'max-width: unset;'; |
| 159 | $style .= 'height: 100%;'; |
| 160 | $style .= 'display: block;'; |
| 161 | $style .= 'position: absolute;'; |
| 162 | $style .= 'object-fit: cover;'; |
| 163 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 164 | $style .= '}'; |
| 165 | $style .= '}'; |
| 166 | $style .= $breakpoint_ie . ' {'; |
| 167 | $style .= $prefix_desktop . $component . ' {'; |
| 168 | $style .= 'width: auto;'; |
| 169 | $style .= 'max-width: unset;'; |
| 170 | $style .= 'height: auto;'; |
| 171 | $style .= 'max-height: unset;'; |
| 172 | $style .= '}'; |
| 173 | $style .= '}'; |
| 174 | |
| 175 | if ( 'none' === $mobile_fitting ) { |
| 176 | $style .= $prefix_mobile . $container . ' {'; |
| 177 | $style .= 'display: block;'; |
| 178 | $style .= '}'; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | // FITTING: None. |
| 183 | if ( 'none' === $mobile_fitting ) { |
| 184 | $style .= ''; |
| 185 | $style .= $prefix_mobile . $container . ' {'; |
| 186 | $style .= 'overflow: hidden;'; |
| 187 | $style .= 'display: flex;'; |
| 188 | $style .= 'display: -ms-flexbox;'; |
| 189 | $style .= 'display: -webkit-box;'; |
| 190 | $style .= 'flex-direction: column;'; |
| 191 | $style .= '-ms-flex-direction: column;'; |
| 192 | $style .= '-webkit-box-orient: vertical;'; |
| 193 | $style .= '-webkit-box-direction: normal;'; |
| 194 | $style .= 'justify-content: center;'; |
| 195 | $style .= '-ms-flex-pack: center;'; |
| 196 | $style .= '}'; |
| 197 | $style .= $prefix_mobile . $component . ' {'; |
| 198 | $style .= 'width: auto;'; |
| 199 | $style .= 'max-width: 100%;'; |
| 200 | $style .= 'height: auto;'; |
| 201 | $style .= 'display: block;'; |
| 202 | $style .= 'flex: 0 1 auto;'; |
| 203 | $style .= '-ms-flex: 0 1 auto;'; |
| 204 | $style .= '-webkit-box-flex: 0;'; |
| 205 | $style .= 'margin: 0 auto;'; |
| 206 | $style .= '}'; |
| 207 | $style .= ''; |
| 208 | $style .= $support_ie . ' {'; |
| 209 | $style .= $prefix_mobile . $container . ' {'; |
| 210 | $style .= 'display: block;'; |
| 211 | $style .= '}'; |
| 212 | $style .= $prefix_mobile . $component . ' {'; |
| 213 | $style .= ( $is_optin && 'four' === $layout_optin ) ? 'flex-shrink: 0;' : ''; |
| 214 | $style .= '}'; |
| 215 | $style .= '}'; |
| 216 | } |
| 217 | |
| 218 | if ( 'none' === $fitting ) { |
| 219 | $style .= $breakpoint . ' {'; |
| 220 | $style .= $prefix_desktop . $container . ' {'; |
| 221 | $style .= 'overflow: hidden;'; |
| 222 | $style .= 'display: flex;'; |
| 223 | $style .= 'display: -ms-flexbox;'; |
| 224 | $style .= 'display: -webkit-box;'; |
| 225 | $style .= 'flex-direction: column;'; |
| 226 | $style .= '-ms-flex-direction: column;'; |
| 227 | $style .= '-webkit-box-orient: vertical;'; |
| 228 | $style .= '-webkit-box-direction: normal;'; |
| 229 | $style .= 'justify-content: center;'; |
| 230 | $style .= '-ms-flex-pack: center;'; |
| 231 | $style .= '}'; |
| 232 | $style .= $prefix_desktop . $component . ' {'; |
| 233 | $style .= 'width: auto;'; |
| 234 | $style .= 'max-width: 100%;'; |
| 235 | $style .= 'height: auto;'; |
| 236 | $style .= 'display: block;'; |
| 237 | $style .= 'flex: 0 1 auto;'; |
| 238 | $style .= '-ms-flex: 0 1 auto;'; |
| 239 | $style .= '-webkit-box-flex: 0;'; |
| 240 | $style .= 'position: unset;'; |
| 241 | $style .= 'margin: 0 auto;'; |
| 242 | $style .= 'object-fit: unset;'; |
| 243 | $style .= '-ms-interpolation-mode: unset;'; |
| 244 | $style .= '}'; |
| 245 | $style .= '}'; |
| 246 | $style .= $breakpoint_ie . ' {'; |
| 247 | $style .= $prefix_desktop . $container . ' {'; |
| 248 | $style .= 'display: block;'; |
| 249 | $style .= '}'; |
| 250 | $style .= $prefix_desktop . $component . ' {'; |
| 251 | $style .= 'width: auto;'; |
| 252 | $style .= 'max-width: 100%;'; |
| 253 | $style .= 'height: auto;'; |
| 254 | $style .= 'max-height: unset;'; |
| 255 | $style .= ( $is_optin && 'four' === $layout_optin ) ? 'flex-shrink: 0;' : ''; |
| 256 | $style .= '}'; |
| 257 | $style .= '}'; |
| 258 | } |
| 259 | } else { |
| 260 | |
| 261 | // FITTING: Fill. |
| 262 | if ( 'fill' === $fitting ) { |
| 263 | $style .= $prefix_mobile . $component . ' {'; |
| 264 | $style .= 'width: 100%;'; |
| 265 | $style .= 'height: 100%;'; |
| 266 | $style .= 'display: block;'; |
| 267 | $style .= 'position: absolute;'; |
| 268 | $style .= 'object-fit: fill;'; |
| 269 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 270 | $style .= '}'; |
| 271 | } |
| 272 | |
| 273 | // FITTING: Contain. |
| 274 | if ( 'contain' === $fitting ) { |
| 275 | $style .= ''; |
| 276 | $style .= $prefix_mobile . $component . ' {'; |
| 277 | $style .= 'width: 100%;'; |
| 278 | $style .= 'height: 100%;'; |
| 279 | $style .= 'display: block;'; |
| 280 | $style .= 'position: absolute;'; |
| 281 | $style .= 'object-fit: contain;'; |
| 282 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 283 | $style .= '}'; |
| 284 | $style .= ''; |
| 285 | $style .= $support_ie . ' {'; |
| 286 | $style .= $prefix_mobile . $component . ' {'; |
| 287 | $style .= 'width: auto;'; |
| 288 | $style .= 'max-width: 100%;'; |
| 289 | $style .= 'height: auto;'; |
| 290 | $style .= 'max-height: 100%;'; |
| 291 | $style .= '}'; |
| 292 | $style .= '}'; |
| 293 | } |
| 294 | |
| 295 | // FITTING: Cover. |
| 296 | if ( 'cover' === $fitting ) { |
| 297 | $style .= ''; |
| 298 | $style .= $prefix_mobile . $component . ' {'; |
| 299 | $style .= 'width: 100%;'; |
| 300 | $style .= 'height: 100%;'; |
| 301 | $style .= 'display: block;'; |
| 302 | $style .= 'position: absolute;'; |
| 303 | $style .= 'object-fit: cover;'; |
| 304 | $style .= '-ms-interpolation-mode: bicubic;'; |
| 305 | $style .= '}'; |
| 306 | $style .= ''; |
| 307 | $style .= $support_ie . ' {'; |
| 308 | $style .= $prefix_mobile . $component . ' {'; |
| 309 | $style .= 'width: auto;'; |
| 310 | $style .= 'height: auto;'; |
| 311 | $style .= '}'; |
| 312 | $style .= '}'; |
| 313 | } |
| 314 | |
| 315 | // FITTING: None. |
| 316 | if ( 'none' === $fitting ) { |
| 317 | $style .= ''; |
| 318 | $style .= $prefix_mobile . $container . ' {'; |
| 319 | $style .= 'overflow: hidden;'; |
| 320 | $style .= 'display: flex;'; |
| 321 | $style .= 'display: -ms-flexbox;'; |
| 322 | $style .= 'display: -webkit-box;'; |
| 323 | $style .= 'flex-direction: column;'; |
| 324 | $style .= '-ms-flex-direction: column;'; |
| 325 | $style .= '-webkit-box-orient: vertical;'; |
| 326 | $style .= '-webkit-box-direction: normal;'; |
| 327 | $style .= 'justify-content: center;'; |
| 328 | $style .= '-ms-flex-pack: center;'; |
| 329 | $style .= '}'; |
| 330 | $style .= $prefix_mobile . $component . ' {'; |
| 331 | $style .= 'width: auto;'; |
| 332 | $style .= 'max-width: 100%;'; |
| 333 | $style .= 'height: auto;'; |
| 334 | $style .= 'display: block;'; |
| 335 | $style .= 'flex: 0 1 auto;'; |
| 336 | $style .= '-ms-flex: 0 1 auto;'; |
| 337 | $style .= '-webkit-box-flex: 0;'; |
| 338 | $style .= 'margin: 0 auto;'; |
| 339 | $style .= '}'; |
| 340 | $style .= ''; |
| 341 | $style .= $support_ie . ' {'; |
| 342 | $style .= $prefix_mobile . $container . ' {'; |
| 343 | $style .= 'display: block;'; |
| 344 | $style .= '}'; |
| 345 | $style .= $prefix_mobile . $component . ' {'; |
| 346 | $style .= ( $is_optin && 'four' === $layout_optin ) ? 'flex-shrink: 0;' : ''; |
| 347 | $style .= '}'; |
| 348 | $style .= '}'; |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 |