@@ -275,6 +275,28 @@ public function create_background_styles() {
275
275
'background-repeat: no-repeat; ' .
276
276
'background-attachment: fixed; ' .
277
277
'} ' ;
278
+ } elseif ( 'fixed ' === $ bg_attach && 'cover ' === $ bg_size ) {
279
+ // This sets the background to a pseudo element to work with iOS.
280
+ $ css = 'body.custom-background::before { ' .
281
+ 'content: ""; ' .
282
+ 'top: 0; ' .
283
+ 'left: 0; ' .
284
+ 'position: fixed; ' .
285
+ 'background-size: cover; ' .
286
+ 'width: 100%; ' .
287
+ 'height: 100%; ' .
288
+ 'z-index: -1; ' .
289
+ 'background-position: center top; ' ;
290
+ if ( $ bg_image ) {
291
+ $ css .= 'background-image: url(" ' . esc_attr ( $ bg_image ) . '"); ' ;
292
+ }
293
+
294
+ if ( $ bg_repeat ) {
295
+ $ css .= 'background-repeat: ' . esc_attr ( $ bg_repeat ) . '; ' ;
296
+ }
297
+
298
+ $ css .= '} ' ;
299
+
278
300
} elseif ( 'fixed ' === $ bg_attach ) {
279
301
$ css = 'body.custom-background { ' .
280
302
'background-attachment: fixed; ' ;
@@ -354,8 +376,8 @@ public function create_overlay_css( $image ) {
354
376
$ color_obj ->alpha = $ alpha ;
355
377
$ new_color = esc_attr ( $ color_obj ->toCSS ( 'rgba ' ) );
356
378
357
- $ rule = "@supports(background-blend-mode: $ type) { body.custom-background, body.custom-background > [id^= \"jarallax-container \"] > div { background-color: $ new_color !important; background-blend-mode: $ type; } } " ;
358
- $ rule .= "@supports not (background-blend-mode: $ type) { body.custom-background, body.custom-background > [id^= \"jarallax-container \"] > div { background-color: $ color !important; opacity: $ alpha; } } " ;
379
+ $ rule = "@supports(background-blend-mode: $ type) { body.custom-background::before, body.custom-background , body.custom-background > [id^= \"jarallax-container \"] > div { background-color: $ new_color !important; background-blend-mode: $ type; } } " ;
380
+ $ rule .= "@supports not (background-blend-mode: $ type) { body.custom-background::before, body.custom-background , body.custom-background > [id^= \"jarallax-container \"] > div { background-color: $ color !important; opacity: $ alpha; } } " ;
359
381
}
360
382
361
383
return $ rule ;
0 commit comments