Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-17-2013, 04:17 PM   PM User | #1
vipercode
New Coder

 
Join Date: Jan 2013
Posts: 21
Thanks: 13
Thanked 0 Times in 0 Posts
vipercode is an unknown quantity at this point
Cool JS Background Help

Hello I have a slight problem with code that have been trying to work out when my images load up in back ground the first image is plain white doesn't start at first image. www.mwbcomputers.com.au and flickers funny

<script language="javascript">
// Super descriptive variable names!!!
var a = self.setInterval('roastBeef()', 4000);
var b = 0;
var c = [
'http://mwbcomputers.com.au/catalog/view/theme/mwbcomputers/image/bg1.png',
'http://mwbcomputers.com.au/catalog/view/theme/mwbcomputers/image/bg2.png',
];

// I shouldn't have used these massive background images!!!
function roastBeef(){
b = (b+1) % c.length ;
return $('body').css('background', 'url("' + c[b] + '") no-repeat center center fixed');
}
</script>
vipercode is offline   Reply With Quote
Old 03-19-2013, 04:14 PM   PM User | #2
ArcticFox
Regular Coder

 
ArcticFox's Avatar
 
Join Date: Jan 2004
Location: Vostok Station, AQ
Posts: 602
Thanks: 35
Thanked 3 Times in 3 Posts
ArcticFox can only hope to improve
Flicker is caused by "fixed". The huge file size probably doesn't help, especially on slower computers (like mine) and/or older video cards.
__________________
<div> - putting your mind in a box since 1997
ArcticFox is offline   Reply With Quote
Reply

Bookmarks

Tags
css, html, java script

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:13 PM.


Advertisement
Log in to turn off these ads.