The Arcive of vBulletin Modifications Site. |
|
Guest Floating Banner for VB4 Details »»
|
|||||||||||||||||||||||||
Dear friends:
Trying to help some users, I copy the codes to have a guest floating banner like the one I got in my forum Agroforum.pe The only problem is that when i scroll down the page, the banner goes down too and desappears from the screen, but this is a good mod to gain more users. It's in spanish right now, but yoy can put the message you want. Paste this code at the begginig of HEADER: Code:
<vb:if condition="$show['guest']">
<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 = 90 //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("topbar").style.visibility="hidden"
}
function staticbar(){
barheight=document.getElementById("topbar").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("topbar");
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>
<div id="topbar"><p align="right"><a href="" onClick="closebar(); return false"><img src="http://static.sunnypages.jp/img/map/close_icon.gif" border="0" /></a>
</p>
<img src="http://www.vbhispano.com/foros/images/icons/icon4.png" /> <b>Hola invitado! Para tener acceso completo y sin publicidades <a href="registro/"><u>registrese gratuitamente!</u></a></b><br>
Imagen publicidad
</div></vb:if>
This is the code to redirect the image to close the banner: Code:
<p align="right"><a href="" onClick="closebar(); return false"><img src="http://static.sunnypages.jp/img/map/close_icon.gif" border="0" /></a> </p> Code:
<img src="http://www.vbhispano.com/foros/images/icons/icon4.png" /> <b>Hola invitado! Para tener acceso completo y sin publicidades <a href="registro/"><u>registrese gratuitamente!</u></a></b> Code:
#topbar {
-webkit-border-radius:4px;
-moz-border-radius:4px 4px 4px 4px;
-moz-box-shadow:1px 1px 1px #666666;
background-color:#ef8d31;
border:1px solid #4A4848;
color:white;
max-width:338px;
min-height:310px;
padding:0 5px 3px;
position:fixed;
right:5%;
top:8%;
z-index:1;
}
Bye Bruno Show Your Support
|
|||||||||||||||||||||||||
| Благодарность от: | ||
| Toorak Times | ||
| Comments |
|
#2
|
|||
|
|||
|
You should place your code in code tags as part of the TOS. This way unlicensed members cannot see it.
|
|
#3
|
|||
|
|||
|
is this working?
|
|
#4
|
|||
|
|||
|
Yes, it's working... Try it, a tell me if you banner stays allways in its possition.
Luck |
|
#5
|
|||
|
|||
|
Picture of the mod...
It's not a very simple mod, but its the only one for vb4 -I think-. Hope someone like it..:up: |
|
#6
|
||||
|
||||
|
Nice mate, ill put in soon.
|
|
#7
|
|||
|
|||
|
Hi,
Can you please let me know how to use it with Google Adsence. Regards. Bhanu |
|
#8
|
|||
|
|||
|
You seem to have stopped it from disappearing below when the page is scrolled down. Can you tell us how you managed to do that?
|
|
#9
|
|||
|
|||
|
For those who are interested, here's how I solved it
HTML Code:
<vb:if condition="$show['guest']"> <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 = 1128 //set x offset of bar in pixels var startY = 54 //set y offset of bar in pixels var verticalpos="frombottom" //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("topbar").style.visibility="hidden" } function staticbar(){ barheight=document.getElementById("topbar").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("topbar"); 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> <div id="topbar"><p align="right"><a href="" onClick="closebar(); return false"><img src="images/misc/exit_ico.jpg" border="0" /></a> </p><font color="black"><b>Hello Guest! Have a question? <font color="green">ASK!</font></b><p>To post questions, download files and to provide solutions to queries <a href="register.php"><u>register for free!</u></a></p><p>Already a member? <a href="login.php?do=login"><u>Click here to sign in!</u></a></p></font><br> </div></vb:if> Code:
#topbar {
border:0px solid #4A4848;
background-color: rgb(255, 235, 144);
opacity: 0.80;
color: white;
max-width:265px;
min-height:18px;
padding: 10px 15px 0px 15px;
text-align: left;
position: absolute;
right:0%;
top: 80%;
z-index:10;
box-shadow: 5px 5px 5px rgb(25, 25, 25);
visibility: hidden;
}
|
|
#10
|
||||
|
||||
|
Thanks for sharing this.
I'm using it to show a cookie warning (EU based site). |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|