iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2009, 02:12 AM
sushil's Avatar
WebProWorld Pro
 
Join Date: Apr 2008
Posts: 118
sushil RepRank 1
Default javascript tip

This is a really cool javascript trick that you can try out. Paste the following code into the address bar when any website with images is loaded. It is best used in uniform size pictures such as the one in Google images
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName(”img”); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position=’absolute’; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+”px”; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+”px”}R++}se tInterval(’A()’,50); void(0);
To stop the animation, just click on your browser’s refresh button.
Reply With Quote
  #2 (permalink)  
Old 01-20-2009, 11:12 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,648
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: javascript tip

Hm... I just get error messages... Just as a test:

Code:
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}setInterval('A()',50); void(0);
This seems to work (above the quotes are converted to high-ascii versions).
__________________
The best way to learn anything, is to question everything.

Last edited by wige; 01-20-2009 at 11:16 AM.
Reply With Quote
  #3 (permalink)  
Old 01-20-2009, 10:35 PM
Moderator
WebProWorld Moderator
 
Join Date: Oct 2003
Location: Alberta, Canada
Posts: 878
weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6weegillis RepRank 6
Default Re: javascript tip

Thanks, guys. Always fun to tinker around, and learn new things at the same time. Here's a boiled down version that works nicely as a drop-in effect on a page full of images, as suggested:

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>javascript animation tip</title>
</head>
<body>
<div>
 <ul>
<li><a href="#" onclick="javascript:setInterval('A()',50); void(0);">Animation Effect</a></li>
</ul>
</div>
<script type="text/javascript"><!--
R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; 
DI=document.getElementsByTagName("img"); 
DIL=DI.length; 
function A(){
 for(i=0; i-DIL; i++){
  DIS=DI[ i ].style; 
  DIS.position='absolute'; 
  DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; 
  DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px";
 }
 R++;
}
//--></script>
</body>
</html>

Last edited by weegillis; 01-20-2009 at 10:37 PM. Reason: typos
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX and javascript calling javascript krnl Web Programming Discussion Forum 14 11-18-2007 11:00 AM
Javascript + RSS + RSS = ? ofoglada Web Programming Discussion Forum 6 02-05-2006 06:33 AM
javascript souvik das Submit Your Logo For Review 2 02-25-2005 11:40 AM
XP SP2, IE and Javascript ChrisBowd Graphics & Design Discussion Forum 1 08-26-2004 08:23 AM
Javascript and php icb01co2 Web Programming Discussion Forum 1 08-09-2004 11:25 AM


All times are GMT -4. The time now is 02:48 AM.



Search Engine Optimization by vBSEO 3.3.0