/    Sign up×
Community /Pin to ProfileBookmark

About animated background in JavaScript…

Dear Sirs,

I have some question about animated gif background
in JavaScript.

I have a such code to achive animated gif background:

<STYLE>
BODY {
background-attachment: fixed;
background-position: 0 0;
background-repeat: repeat
</STYLE>

<SCRIPT>
// This SCRIPT block MUST be included after the BODY tag
var timerID

function StopBackground() {
clearTimeout(timerID)
}

function AnimateBackground(hPos,vPos,hInc,vInc,delay) {

if (arguments[5])
document.body.style.backgroundImage = “url(“” + arguments[5] + “”)”

if (arguments[6])
document.body.style.backgroundRepeat = arguments[6]

if (!isNaN(hPos)) {
if ((hInc!=0) && (hPos > 0)) hPos=-100000
hPos+=hInc
}
if (!isNaN(vPos)) {
if ((vInc!=0) && (vPos > 0)) vPos=-100000
vPos+= vInc
}

document.body.style.backgroundPosition= hPos + ” ” + vPos
if (isNaN(hPos)) hPos = “”” + hPos + “””
if (isNaN(vPos)) vPos = “”” + vPos + “””
timerID = setTimeout(“AnimateBackground(“+hPos+”,”+vPos+”,”+hInc+”,”+vInc+”,”+delay+”)”,delay)
}

AnimateBackground(0,”Bottom”,-10,0,50, “clouds.jpg”)

</SCRIPT>

The problem is when on the same page
with animated gif background
I have some link
( <a href = “”></a> )
to some another page.
For example:

<td class=nav_top align=center width=9%>
<a href=”http://www.fortuneline.ru/” target=blank>
<img src=”img/icons_gad.gif” border=0 style=’vertical-align:middle’>
<br>
XYZ
</a>
</td>

When I click to the link above, the whole animated background become
just as a simple white background, and doesn’t return to the original state.

Please advice how to achive animated background
by using Javascript without influence on the rest page elements
behaiving.

Here is the page to demonstrate my question:

http://www.mistikaalla.com/avatars_ex.htm

If you click on the second from the left side

red heart of the menu, the other WebPage opens.

The original page’s background become entire white.

And it seems to try to download the background picture,

but didn;t succeed to do it.

Please advice how to achive the animated background

without having a such influence on the rest web page

behaivor.

Thanks in advance,

Dimi.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @dmi_gold spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...