0

I wish I had more to show, but the problem is simple. Following the github instructions, I place:

$.backstretch("path/to/image.jpg");

In the JS. It does apply the bg, but not in the body itself. At the end of the inner body it pastes:

<div class="backstretch" style="left: 0px; top: 0px; overflow: hidden; margin: 0px; padding: 0px; z-index: -999999; position: fixed; width: 1920px; height: 717px;"></div>

I tried the following as well:

$('body').backstretch("path/to/image.jpg");

It simply does not want to apply to the body. I need its magic on the body because I believe there's a chrome bug that will be resolved by doing such.

Vael Victus
  • 3,966
  • 7
  • 34
  • 55
  • That's exactly what the plugin does. It doesn't touch `body`. It's working as designed. If you give it a selector, it will add a `.backstretch` div to *that* container. It can *only* add `.backstretch` divs. – user229044 Oct 23 '14 at 04:52

1 Answers1

0

It seems like they have a bug in their help. Do it like this:

$('body').backstretch("path/to/image.jpg", {});
Alexei Rayu
  • 406
  • 1
  • 4
  • 14
  • Your idea didn't work for me Alexei. Backstretch.js still creating a div with your approach and not putting the image on the body. – Eggs Mar 31 '17 at 18:52
  • In the current code, backstretch checks in your container has an element with class "backstretch" in it. So, you may be able to apply it to the body tag by applying backstretch to the html element, and making sure your body has a class of "backstretch". – Alexei Rayu Apr 02 '17 at 05:58