Hello,
That's the first time ever I write code in javascript.
I've put a large background picture, much larger than the window, and
set "background-repeat: repeat" to show it in a 'mosaic' fashion.
I intend to animate the background by shifting it's position every few
seconds. As the image is much larger than the window, it will
(hopefully) look like a different background image.
I try to make the shift take place in two steps, the first one fast
enough to be noticed and then a second last one. Later on I'm going to
add a sound, I'm attempting to make it look like a microfilm being
moved around in a microfilm viewer.
<script language="JavaScript">
var ID1 = window.setInterval(function(){fondo()
+window.setTimeout('fondo()',90);},2500)
function fondo()
{document.body.style.backgroundPosition=(Math.rand om()*100)+'% '+
(Math.random()*100)+'%';}
</script>
I've also put this:
<body onunload="window.clearInterval(ID1); (..)
Because sometimes when exiting/comingBak to the page, the background
animation was accelerating.
There's a small animated gif on the top of the page that slows down a
lot on some browsers during the background animation, but at random
intervals. I'm not sure if it has to do with this code, but I guess
so.
I know the code is working, but I'm not sure if it's ok. What do you
think ?
In case you want to see it the url is :
<http://homepage.mac.com/jorgechamorro/a2things/>
Thanks,
--Jorge. 1 1304
On May 1, 10:27 am, biel...@terra.es wrote:
Hello,
That's the first time ever I write code in javascript.
I've put a large background picture, much larger than the window, and
set "background-repeat: repeat" to show it in a 'mosaic' fashion.
I intend to animate the background by shifting it's position every few
seconds. As the image is much larger than the window, it will
(hopefully) look like a different background image.
I try to make the shift take place in two steps, the first one fast
enough to be noticed and then a second last one. Later on I'm going to
add a sound, I'm attempting to make it look like a microfilm being
moved around in a microfilm viewer.
<script language="JavaScript">
var ID1 = window.setInterval(function(){fondo()
+window.setTimeout('fondo()',90);},2500)
function fondo()
{document.body.style.backgroundPosition=(Math.rand om()*100)+'% '+
(Math.random()*100)+'%';}
</script>
I've also put this:
<body onunload="window.clearInterval(ID1); (..)
Because sometimes when exiting/comingBak to the page, the background
animation was accelerating.
There's a small animated gif on the top of the page that slows down a
lot on some browsers during the background animation, but at random
intervals. I'm not sure if it has to do with this code, but I guess
so.
I know the code is working, but I'm not sure if it's ok. What do you
think ?
In case you want to see it the url is :
<http://homepage.mac.com/jorgechamorro/a2things/>
Thanks,
--Jorge.
the effect is a nice idea. You might be able to acheive a smooth
transition using a div styled to have z index below the rest of the
body content, and use one of the transition effects that libraries
like scriptaculous.js provide. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mudge |
last post by:
Please, someone, tell me why OO in PHP is better than procedural.
|
by: bigoxygen |
last post by:
Hi.
I'm using a 3 tier FrontController Design for my web application right
now.
The problem is that I'm finding to have to duplicate a lot of code for
similar functions; for example, listing...
|
by: jason |
last post by:
Hello.
Newbie on SQL and suffering through this.
I have two tables created as such:
drop table table1;
go
drop table table2;
go
|
by: Dario de Judicibus |
last post by:
I'm getting crazy. Look at this code:
#include <string.h>
#include <stdio.h>
#include <iostream.h>
using namespace std ;
char ini_code = {0xFF, 0xFE} ;
char line_sep = {0x20, 0x28} ;
|
by: Andrew Thompson |
last post by:
It seems most people get there JS off web sites, which is
entirely logical. But it is also a great pity since most
of that code is of such poor quality.
I was looking through the JS FAQ for any...
| |
by: ED |
last post by:
I currently have vba code that ranks employees based on their average
job time ordered by their region, zone, and job code. I currently
have vba code that will cycle through a query and ranks each...
|
by: Namratha Shah \(Nasha\) |
last post by:
Hey Guys,
Today we are going to look at Code Access Security.
Code access security is a feature of .NET that manages code depending on its
trust level. If the CLS trusts the code enough to...
|
by: Joe Fallon |
last post by:
I have some complex logic which is fairly simply to build up into a string.
I needed a way to Eval this string and return a Boolean result.
This code works fine to achieve that goal.
My...
|
by: Alan Silver |
last post by:
Hello,
Newbie here, so please forgive what is probably a basic question ...
I see a lot of discussion about "code behind", which if I have
understood correctly, means that the script code goes...
|
by: tshad |
last post by:
I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.
I know that most people (and books and articles)...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |