Javascript examples for CSS Style Property:backgroundAttachment
Set the background-image to be fixed
<!DOCTYPE html> <html> <body style="background:#f3f3f3 url('http://java2s.com/resources/c.png') no-repeat fixed;"> <h1>Hello World!</h1> <p>The background-image is fixed.</p> <p>The background-image is fixed.</p> <p>The background-image is fixed.</p> <p>The background-image is fixed.</p> <p>The background-image is fixed.</p> <p>The background-image is fixed.</p> <button onclick="myFunction()">Get background-attachment value</button> <script> function myFunction() {//from ww w .j a va2 s .c om console.log(document.body.style.backgroundAttachment); } </script> </body> </html>