Youtube Demo :http://www.youtube.com/v/wUZC9W9V9jI
Плавающее окошко уведомлений, то, что в красном облачке. При скроллинге страницы оно всегда теперь на виду.
For a Continuous activity on Site. Users need great and Powerful Notification system as FB has.
For Powerful Notifications System See Here
Now the The question arises How these Notifications are Shown ?
The greatest Advantage of Balloon Notification is that it doesn't Need any Page Refresh.
whereas the Notification Block is not advisable as it needs a Page refresh.
I am keeping the Balloon Notifications.
With this Mod . the Notification Balloon Will Float on Users' Computer Screen.
Here are the Steps to Follow.
Step 1:
Open Header.tpl in /templates folder
Find :
PHP:
{* SHOW MY NOTIFICATIONS POPUP *}
{if $notifys[1] != 0}
<div id='newupdates' style='display:none;'>
<div class='newupdates_content' style='display:none;'>
<a href='javascript:void(0);' class='newupdates' onclick="TB_show('{lang_print id=1198}', '#TB_inline?height=150&width=300&inlineId=newupdates_popup', '', './images/trans.gif');">{assign var="notify_total" value=$notifys[0]|@count}{lang_sprintf id=1019 1="<span id='notify_total'>`$notify_total`</span>"}</a></b>
<a href='javascript:void(0);' class='newupdates' onclick="hideNewupdates();">X</a>
</div>
</div>
and Replace with
PHP:
{* SHOW MY NOTIFICATIONS POPUP *}
<div class='newupdates' id='newupdates'>
<div class='newupdates_content'>
<a href='javascript:void(0);' class='newupdates' onclick="SocialEngine.Viewer.userNotifyPopup(); return false;">
{assign var="notify_total" value=$notifys.total_grouped}
{lang_sprintf id=1019 1="<span id='notify_total'>`$notify_total`</span>"}
</a>
<a href='javascript:void(0);' class='newupdates' onclick="SocialEngine.Viewer.userNotifyHide(); return false;">X</a>
</div>
</div>
Now the Notification Balloon Will WOrk
In Step 2 We Will be Floating this Balloon on the screen So that If a user is At the Bottom of the Page , He can be Shown the Notification.
Directly Below the Above Code
Add :
PHP:
{literal}
<script type="text/javascript">
var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
var startX = 30 //set x offset of bar in pixels
var startY = 5 //set y offset of bar in pixels
var verticalpos="fromtop" //enter "fromtop" or "frombottom"
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("newupdates").style.visibility="hidden"
}
function staticbar(){
barheight=document.getElementById("newupdates").offsetHeight
var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
var d = document;
function ml(id){
var el=d.getElementById(id);
if (!persistclose || persistclose && get_cookie("remainclosed")=="")
el.style.visibility="visible"
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function(){
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : iecompattest().scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("newupdates");
stayTopLeft();
}
if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar
</script>
{/literal}
Credit Goes to thegame91
Before Enjoying this kool Stuff , See My Avatar.
Cheers !
P.S : For Changing X and Y Axis Position , In ABove Code Find :
PHP:
var startX = 30 //set x offset of bar in pixels
var startY = 5 //set y offset of bar in pixels
and change accordingly