/    Sign up×
Community /Pin to ProfileBookmark

Fading in and out slowly???

I am working on a touch screen app. When user presses a key, key should fade slowly from black-yellow-black color. I could not get it work. Please someone help me. Thanks.

[CODE]
<html>

<head>
var inc = .01;
var delay =100;

function toggleImage(obj) {
obj.style.backgroundColor=”#FF0000″;
setTimeout(‘fadeOut(“‘+obj+'”,1-inc);’,delay);
setTimeout(‘fadeIn(“‘+obj+'”,0);’,delay);
obj.style.backgroundColor=”#FFFFFF”;

}

function fadeOut(obj,opacity) {
if (opacity > 0) {
obj.opacity = opacity;
// IE
obj.filter = “alpha(opacity=”+opacity*100+”)”;
setTimeout(‘fadeOut(“‘+obj+'”,”+opacity-inc+”);’,delay);
}
else {
obj.style.opacity = 0;
// IE
obj.style.filter = “alpha(opacity=0)”;
}
}

function fadeIn(obj,opacity) {
if (opacity < 1) {
obj.style.opacity = opacity;
obj.style.filter = “alpha(opacity=”+opacity*100+”)”;
setTimeout(‘fadeIn(“‘+obj+'”,”+opacity+inc+”);’,delay);
}
else {
obj.style.Opacity = .9999999;
// IE
obj.style.filter = “alpha(opacity=100)”;
}
}
</script>

</style>
</head>

<body>
<button onclick=”toggleImage(this);”>WEBDEVELOPER.COM</button>
</body>
</html>
[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@codingisfunauthorMar 28.2009 — Fixed. Ignore this post.
×

Success!

Help @codingisfun 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.18,
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,
)...