From your screenshot the problem seems to be a iframe
scrolling problem. I can reproduce your issue not only on Safari
, but on Firefox
and Chrome
as well.
In the embedded view of jsfiddle
, the "result" iframe is in a div with padding-top
. But the iframe
height is calculated without the padding
, so it becomes possible to scroll
in the frame. Your fixed background
stays at the bottom
of its own window
, but this window scrolls, so at some points it gets lower that bottom of the browser. You can test it by opening your link:
http://jsfiddle.net/louiswalch/b6hszasz/1/embedded/result/
Then opening the console and run this line:
document.getElementById('result').style.padding = '0px'
You should see your background
behaving normally. Since iframes in jsfiddle
are sandboxed, not sure there's a way from your iframe
to correct this.
Note that this is based on your screenshot, your fiddle and on the behaviors on my browsers, there may be another issue as well. But on my end I can reproduce this problem fairly easily.
EDIT:
Looking at your live site, it's pretty clear there's another issue, which clearly looks like a bug. What seems to happen is that Safari considers the viewport
as being the outerHeight
of the window instead of innerHeight
. I'm guessing it's because of the transparency effect in the toolbar/header. In any case, you can see this clearly running a few commands in console. This one doesn't move the image at all, which suggest that the 100% position y
is made according to outerHeight
instead of innerHeight
:
$('.image').css("background-position", "left -" + ($('.image').width() - window.outerHeight) + "px")
But when using this one moves it properly:
$('.image').css("background-position", "left -" + ($('.image').width() - window.innerHeight) + "px")
So I guess one solution would be to detect Safari and define dynamically background position this way. But then you would have to redefine on resize as well.