Link to home
Start Free TrialLog in
Avatar of LeighJor
LeighJorFlag for Afghanistan

asked on

How to make background image responsive for ipad phone ie

I am using the script below to for random background images.
 I am also using a css class which successfully make normal (non-background images) responsive.
I want to know a way to make the random background images responsive to display size eg IE, ipad, smartphone. At moment they cover smaller display but distorted and IE shows up as fixed in left top.
Thanks in advance and anticipation .

<script type="text/javascript">
var totalCount = 5;
function ChangeIt()
{
var num = Math.ceil( Math.random() * totalCount );
document.body.background = 'bgimages/'+num+'.jpg';
document.body.style.backgroundSize = '100% 100%';
document.body.style.backgroundRepeat = "no-repeat";
document.body.style.backgroundAttachment="fixed";
// Background repeat
}
</script>
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial