1

I'am busy with my website, and now I have a issue.

When i scroll down to my contact page, my browser starts to lagg, because i have a background image with the property scroll, and size cover.

So i googled a bit and the result was that the property cover causes the laggs.

How can i fix this? I need my background size covered because i have my website responsive

My code:

background-attachment: scroll,  fixed;
background-color: #666;
background-image: url("../images/black.png"), url("../images/bg-footer.jpg");
background-position: center,    center center;
background-size: cover, cover;
Thijs Kempers
  • 459
  • 6
  • 17

1 Answers1

1

Can i ask why you need to use background-attachment: scroll at all?

You have set the background image to cover the full width of its container, which means it's not going to change position on scroll anyway.

You are forcing the browser to recalculate the image size whenever you scroll the mouse, causing the lag.

You could also try using other properties like contain or 100% width to fix your image.

Ucinorn
  • 648
  • 7
  • 21
  • The images resizes to the full size of the width. Then it has to scroll with. Found my inspiration at: http://html5up.net/alpha – Thijs Kempers Nov 17 '14 at 09:57
  • yep, like i said above, this is becasue the browser is dynamically calculating the full screen size and applying it to the image whenever you change the screen position. This means scrolling down makes the browser perform this complex calculation many times a second. The answer is not not use background cover with background scroll. These answers should help too: http://stackoverflow.com/questions/7869086/poor-performance-of-chrome-using-background-size-cover http://stackoverflow.com/questions/7033979/my-fixed-background-made-scrolling-the-site-very-slow-what-can-i-do-to-improve – Ucinorn Nov 18 '14 at 00:24