Animating Joomla's system messages with MooTools

Monday, 23 June 2008

Here's a simple way to render an animation when your users get a system message. The Javascript searches for an element with the ".message" class, it waits 2 and a half seconds, then it fades and shrinks the message away.

To make sure the message is in sight, WinScroller scrolls to the element with the 'header' id. You need to modify this id to suit your templates's header or main column. 

The message is passed as a request variable, 'mosmsg'.

This code snippet should be pasted into the head section of your template (between <head></head> tags)

<script type="text/javascript" >
 var tmjmosmsg,fx;
 function pload(){
 var el=tmjmosmsg[0];
 var h=el.getSize().size.y;
 fx = new Fx.Styles(el, {duration:900, wait:false});
 //scrol to message
 winScroller = new Fx.Scroll(window);
 //delayed start, then remove the html element upon completion

Make sure you loaded mootools v.1.11 before this code. Joomla 1.5 loads it automatically for you, Joomla 1.0.15 needs to specifically load mootools trough a <script src="..."></script> tag.

The file you need to alter is located at templates/your_current_template/index.php.

 The script is installled on this site, you'll notice it when posting comments.

Are you a Joomla/PHP/Web developer? You may want to check our freelance marketplaces list.

Give us some social love (it really works now)!

Reddit!! StumbleUpon! Yahoo! Swik!

Comments (6)
RSS comments
1. ..yeah!!16-11-2009 10:46

Hi there 
Crazy animation. Be sure you have here a vailid id from your template: 
It is not always header!!! 
Also if you use beez or yootheme overrides check the xhtml code from you system message like mentioned above: 
Raphael from artd webdesign

2. Great09-11-2009 09:37

Great skript, Thanks!

3. Code28-08-2009 20:36

With the following code you can simply set the the display:none; for the messages after 3,5 seconds: 
function disablediv(dl){ 
var objDiv = document.getElementById(dl);"none";  

window.setTimeout("disablediv('system-message')",3500); /* Hier sind es 5sek. */ 
Not that cool, but simple. 
Another solution could be here:

4. Joomla 1.5.9 Fix!07-03-2009 23:36

I needed to make a slight modification for it to work for me. 
change the line: 

5. Great07-03-2009 23:23

Looks good!

6. Just installed script. Not working.07-08-2008 10:34

I just put the code in the element of my template and it doesn't seem to be working. 
Going to play around with it a little. But, I wanted to see what it's supposed to look like,

Write Comment
  • Please keep the topic of messages relevant to the subject of the article.
  • Please don't use comments to plug your web site. Links are rel='nofollow'-ed
  • Please refresh the page if you're having trouble with the security image code

:) :grin ;) 8) :p
:roll :eek :upset :zzz :sigh
:? :cry :( :x
Code:* Code

Last Updated ( Thursday, 18 June 2009 )
Web Hosting

Europe freelancer directory


Subscribe to TeachMeJoomla's newsletter

Auto tags

joomla system message

joomla system messages

showing jooomla system message

animate joomla system messages

message joomla

system message joomla

joomla system message lightbox

change system messages joomla

joomla messages

joomla get system message

joomla change system message

joomla system message in lightbox

mootools joomla 1.0.15

mootools message

joomla message box

joomla system message mootools

joomla system messages in LightBox

animated system messages joomla

sistem message joomla

joomla id="system-message"

system-message + joomla

joomla system messages style