Just wanted to add to this:
I have found that the above mentioned code does not work correctly for me as I had an image specific height. I have found that using the :not() css-selector is better.
The code I used was:
#parallax-bg {
display: none;
}
.home #parallax-bg {
display: block;
}
.page:not(.home) #masthead {
margin-bottom: 50px;
}
Hope this helps others who might have had the same issue as I had.