Skip to content
WJunction - Webmaster Forum

[phpbb] Floating jquery message

Status
Not open for further replies.
Hey guys thought i would start contributing some useful stuff for phpbb im no pro at it so if you want to complain don't bother im going to show you how to make a nice jquery floating message

You can see a demo of it on my forum (the yellow bar at the top)
Code:
http://gfx-scene.com/forums/
What you need ?
Code:
The latest version of jquery-http://jquery.com/
Code:
This image (rename it to 12-em-cross.png )-http://imgcentre.com/img/uploads/big/99e9a22135.png

If you are using a dark background use this image instead (thanks to surfing)
http://imgcentre.com/img/uploads/big/fd0fb51a03.png

Where to put these files

put the jquery script in {your style name}/theme
Put the image file in {your style name}/theme/images

What to edit


Ok 1st open {your style name}/themplate/overall_header.html

Find:
Code:
</head>
Before add:
Code:
<script type="text/javascript" language="javascript" src="{T_THEME_PATH}/jquery-1.4.1.min.js"></script> 
<script type="text/javascript" language="javascript"> 
//  Developed by Roshan Bhattarai  
//  Visit http://roshanbh.com.np for this script and more. 
//  This notice MUST stay intact for legal use 
$(document).ready(function() 
{ 
    //scroll the message box to the top offset of browser's scrool bar 
    $(window).scroll(function() 
    { 
          $('#message_box').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});   
    }); 
    //when the close button at right corner of the message box is clicked  
    $('#close_message').click(function() 
    { 
          //the messagebox gets scrool down with top property and gets hidden with zero opacity  
        $('#message_box').animate({ top:"+=15px",opacity:0 }, "slow"); 
    }); 
}); 
 </script>
Find: (might be different its under the </head> tag)
Code:
<body id="phpbb">
Add after:
Code:
<div id="message_box">
    <img id="close_message" style="float:right;cursor:pointer" src="{T_THEME_PATH}/images/12-em-cross.png" />
Your message goes here</a>
</div>
If you want this to only show for guests just add this instead
Code:
<!-- IF not S_USER_LOGGED_IN --><div id="message_box">
    <img id="close_message" style="float:right;cursor:pointer"  src="{T_THEME_PATH}/images/12-em-cross.png" />
Your message goes here</a>
</div><!-- ENDIF -->
Ok now open {your style name}/theme/stylesheet.css

Add this to the bottom (you can add it to any other stylesheets on prosilver)

Code:
#message_box {
position: absolute;
top: 0; left: 0;
z-index: 10;
background:#ffc;
padding:5px;
border:1px solid #CCCCCC;
text-align:center;
font-weight:bold;
width:99%;
}
Thats is credits go to
Code:
http://roshanbh.com.np/2008/07/top-floating-message-box-using-jquery.html
i just adapted it for phpbb enjoy all need any help just ask here and i will try me best to help (y)
 

10 comments

Might want to fix some things such as:
Code:
<script type="text/javascript" language="javascript" src="{T_THEME_PATH}/jquery-1.4.1.min.js"></script>
Code:
<script type="text/javascript" language="javascript" src="{T_THEME_PATH}[COLOR="Red"]/theme/[/COLOR]jquery-1.4.1.min.js"></script>

And

Code:
<!-- IF not S_USER_LOGGED_IN --><div id="message_box">
    <img id="close_message" style="float:right;cursor:pointer"  src="{T_THEME_PATH}/images/12-em-cross.png" />
Your message goes here</a>
</div><!-- ENDIF -->

Code:
<!-- IF not S_USER_LOGGED_IN --><div id="message_box">
    <img id="close_message" style="float:right;cursor:pointer"  src="{T_THEME_PATH}[COLOR="red"]/theme/[/COLOR]images/12-em-cross.png" />
Your message goes here</a>
</div><!-- ENDIF -->
 
Works well but that cross is only for light backgrounds xD will see if i can dig up a better one for darker backgrounds for you (y)
 
No problem glad you like it i thought it was a good alternative to the guest image so if your no good at gfx or a little short on funds (like i am now :P) to pay for one or you just like jquery
 
Status
Not open for further replies.

About the author

S
Active Member · Joined
2,369
Messages
486
Reactions
83
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom