V
V
Vasily Petrov2016-10-02 01:05:49
css
Vasily Petrov, 2016-10-02 01:05:49

background-attachment: fixed doesn't work on mob. device, what's the problem?

The question is in the title. I checked it on the iPad and on some poop for 1k rubles (android, ps I have nothing against android) On the iPade, the background image increases (approaches) 2 times
Here is a piece of code:

#main {
  background: url(../images/tym2.jpg);
  background-position: top center;
  background-attachment: fixed;
  height: 110vh;
  position: relative;
  -webkit-background-size: cover;
  background-size: cover;
}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
fsockopen, 2016-10-02
@fsockopen

попробуй добавить overflow-y: scroll; вместо него
задать #main и родителю height: 100%;
родителю overflow-y: hidden;

Сергей, 2016-10-02
@void01

if (iosVersion >= 7) {
    $(document).scroll(function() {
        $('#main').css('background-position', '0px ' + $(document).scrollTop() + 'px');
    });
}

еще можно явно указать размеры -webkit-background-size: 2650px 1440px;

Максим, 2016-10-02
@maxnrg33

лучше сделай блок с position: fixed; и ему дай бэкгроунд
а контенту задай z-index: 1;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question