Page 1 of 1

Make a background not repeat itself

Posted: Tue Jan 10, 2017 12:08 pm
by Lars Holtet

Hi! I have set a custom background in my app, but if you scroll far down- it will repeat it self..

How and what do i add to the code to make it stop repeat iself?

This is my code:

$('div[dsid="mobilecontainer"]').css('background-image',
'url("img/bg3.png")');


Make a background not repeat itself

Posted: Tue Jan 10, 2017 12:11 pm
by Lars Holtet

I tried to add this:

$('div[dsid="mobilecontainer"]').css('background-repeat',
'no-repeat');

But then i only got a white background below the background pic when scrolling..

I want everything to be scrollable on the background :P


Make a background not repeat itself

Posted: Tue Jan 10, 2017 12:28 pm
by Lars Holtet

Solved! Complete code:

$('div[dsid="mobilecontainer"]').css('background-image',
'url("img/bg3.png")');

$('div[dsid="mobilecontainer"]').css('background-repeat',
'not-repeat');

$('div[dsid="mobilecontainer"]').css('background-attachment',
'fixed');