Languages

Menu
Sites
Language
how to prevent background img be swiped
.ecopage{
background-image:url(../resource/ECO.png);
position: absolute;
left:0px;
top:0px;
width: 100%;
height: 100%;
display: none;
}
<div id="eco" class="ecopage">
        <div  align = "center">  
       </div> 
    </div>

Hi,

I am developing an Gear S2 app, however, if I swipe my screen upwards, the background img would go upside. Accordingly, it will show black background with nothing real contents.

My img resolution is 360*360, which fulfill the watch exactly. I hope this image could be fixed, always occupying the whole screen. 

My application does not response to "swipe left/right", and it has no tau lib. So I think disable swipe action is meaningless. 

Anyone knows how to resolve this issue?  Thanks.

 

  

 

View Selected Answer

Responses

7 Replies
Mark as answer
AVSukhov

Hello,

Try to set background size: background-size: 100% 100%;

or you can use position: fixed. with top, left, right, bottom: 0px

 

Pang

Thanks AVSukhov, the second method works for me, while the first one is not OK. Thanks for your suggestion.

 

Palitsyna

Hello,

try to use position property, as AVSukhov suggested. Here you can find information about this property, it also contains examples: http://www.w3schools.com/cssref/pr_class_position.asp

Pang

Thank for your examples Palitsyna, it has been resolved by changing position property.  Now I have better understanding on "fixed" and "absolute".

Palitsyna

Hello,

it's great, that you solved your problem quickly.

just FYI, if you want to understand the difference between position property values, you can study this example:  http://www.w3schools.com/css/css_positioning.asp

 

colin Rao

Hi,

Try to set the background img on the body tag with width&height 100%.

Pang

Thanks colin, I tried your method and it also works good.