If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / item added - fade out

item added - fade out

Locked

Started by bigbadboy on 4 Sep 2008, 12:23 AM · Views: 1,221

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
4 Sep 2008, 12:23 AM
#1
bigbadboy avatar

bigbadboy

Totally Zenned

Join Date:
Apr 2008
Location:
London
Posts:
557
Plugin Contributions:
0

item added - fade out

I've added a sneaky little effect that shows/ hides an "item added" message.
Currently the message shows the div then, after a few seconds, hides it again.
What I want to do is fade out instead of just hide.

You can see it in action here (click 'add to basket' then message appears top right):
http://tinyurl.com/sf-effect

This is the script placed in the head:

<script type="text/javascript">
function hideIt() {
  document.getElementById("message").style.display = "none";
}
setTimeout("hideIt()", 3000); // after 3 sec
</script>

Here is the CSS:

.messageStackSuccess {
	width:100px;
	float:right;
	background-color:#b64926;
	color:#ffff00;
	text-transform:uppercase;
	text-align:center;
	font-size:80%;
	font-weight:bold;
	padding-right:20px;
	}

Thanks in advance.

4 Sep 2008, 12:44 AM
#2
bigbadboy avatar

bigbadboy

Totally Zenned

Join Date:
Apr 2008
Location:
London
Posts:
557
Plugin Contributions:
0

Re: item added - fade out

Forgot to add the code for the actual div that's shown:

<div id="message"><?php
  // Display all header alerts via messageStack:
  if ($messageStack->size('header') > 0) {
    echo $messageStack->output('header');
  }
  if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) {
  echo htmlspecialchars(urldecode($_GET['error_message']));
  }
  if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
   echo htmlspecialchars($_GET['info_message']);
} else {

}
?></div>
4 Sep 2008, 3:34 PM
#3
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: item added - fade out

I've always assumed that kind of thing was done with an animated gif, with increasingly faded layers.