Go Back   CodingForums.com > :: Client side development > JavaScript programming

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 01-27-2013, 04:46 PM   PM User | #1
pinastro
New to the CF scene

 
Join Date: Jan 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
pinastro is an unknown quantity at this point
How to wait till the images download

I am working on a website to build a brand for a video game.

http://thedevigngame.com/

The problem is when the internet is slow and the images take time to download and gives a jittery effect...I want to avoid that..else everything is fine

I want to javascript to wait for the images to download to the client side before the javascript loads....how to do that...

The code is given below:

Code:
<html>
<head> <title> deVign - a game by pinastro </title>
 <style>
   
   .fadein { position:relative;width:50%; }
   .fadein img { position:absolute; left:51%; top:50%; }
  .subscription {position:absolute; left:44%; top:70%; style="float:left;"}

 </style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

<script>

$(function(){
    $('.fadein img:gt(0)').hide();
    setInterval(function(){
      $('.fadein :first-child').fadeOut()
         .next('img').fadeIn()
         .end().appendTo('.fadein');}, 
      100);
});

</script>

 
</head>
<body bgcolor="black">
</center>

<div class="fadein">
<img src="0001.png"/>
<img src="0002.png"/>
  <img src="1.png"/>
<img src="1001.png"/>
<img src="1002.png"/>
<img src="1003.png"/>
<img src="1004.png"/>
  <img src="2.png"/>  
  <img src="3.png"/>  
 <img src="4.png"/>  
 <img src="5.png"/>  
<img src="6.png"/>  
 <img src="7.png"/>  
   <img src="8.png"/>  
   <img src="81.png"/> 
<img src="81.png"/>  
<img src="81.png"/>   
<img src="9.png"/>  
<img src="91.png"/>  
<img src="92.png"/>  
<img src="93.png"/>  
<img src="94.png"/>  
<img src="95.png"/>  
<img src="96.png"/>  
<img src="97.png"/>  

<img src="99.png"/>
<img src="991.png"/>    
<img src="992.png"/>    
<img src="993.png"/>    
<img src="994.png"/>    
<img src="995.png"/>    
<img src="996.png"/> 
<img src="997.png"/> 
<img src="998.png"/> 
<img src="999.png"/> 
<img src="9991.png"/> 
<img src="9992.png"/> 
<img src="9993.png"/> 
<img src="9994.png"/> 
<img src="9995.png"/> 
<img src="9996.png"/> 

</div>
<br/>

<div style="float:left;">
<font color="grey" family="musio">

<!--
<form action="Send.php" method="post"> 
		<div  class="subscription" style="float:left;">
			
			<div>
			<input name="email" placeholder="submit email id 4 updates" type="text" class="form_1" style="float:left;">
			</div>
			
					
			
			<div><input type="submit" name="Send" value="Submit" style="float:left;">
			
			
	</form>
	-->

</font>

</div>

</center>	
</body>
</html>
pinastro is offline   Reply With Quote
Old 01-28-2013, 12:42 PM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,455
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Code:
window.onload=function(){
    $('.fadein img:gt(0)').hide();
    setInterval(function(){
      $('.fadein :first-child').fadeOut()
         .next('img').fadeIn()
         .end().appendTo('.fadein');}, 
      100);
};
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

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 09:46 PM.


Advertisement
Log in to turn off these ads.