segunda-feira, 17 de setembro de 2012

Add popup box like the Facebook blog without using jQuery

Most codes available to add popup to blog feeds, facebook fan page etc.. comes with jQuery there is the problem, because when the blog has already had jQuery what the blog does not work. In this tutorial I will be teaching you how to add a popup with a Facebook page to enjoy in blogs or sites that already have jQuery. What I teach is the same that we use in Tips and Computer Games.


This popup you can see in the image just above only loads once per session, ie, whether a person enters your blog to see other pages, but it will not appear and will only appear if you close the blog and open it again.

To add jQuery popup without follow the steps below:

1 - Enter the HTML on your blog "Design" and press Ctrl + f and search for </ head> above it and paste the following codes:

<style>
#topbar{
position:absolute;
border: 2px solid green;
padding: 5px 0px 0px 0px;
margin: 100px 0px 0px 200px;
background-color: #ffffff;
font-size:12px;
width: 400px;
visibility: hidden;
z-index: 400;}
</style>


Editing this code:

width: the width place. The height is automatic.
bolder: The border width and color of it
margin: the first and last (100px and 200px) change the values ​​to change the location of the popup in blog

2 - Now on down the line </ head> paste the code below:

<!-- Java PopUp inicio -->
&lt;script type=&quot;text/javascript&quot;&gt;
var persistclose=1
var startX = 20
var startY = 5
var verticalpos=&quot;fromtop&quot;
function iecompattest(){
return (document.compatMode &amp;&amp; document.compatMode!=&quot;BackCompat&quot;)? document.documentElement : document.body
}
function get_cookie(Name) {
var search = Name + &quot;=&quot;
var returnvalue = &quot;&quot;;
if (document.cookie.length &gt; 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(&quot;;&quot;, offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function closebar(){
if (persistclose)
document.cookie=&quot;remainclosed=1&quot;
document.getElementById(&quot;topbar&quot;).style.visibility=&quot;hidden&quot;
}
function staticbar(){
barheight=document.getElementById(&quot;topbar&quot;).offsetHeight
var ns = (navigator.appName.indexOf(&quot;Netscape&quot;) != -1) || window.opera;
var d = document;
function ml(id){
var el=d.getElementById(id);
if (!persistclose || persistclose &amp;&amp; get_cookie(&quot;remainclosed&quot;)==&quot;&quot;)
el.style.visibility=&quot;visible&quot;
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x+&quot;px&quot;;this.style.top=y+&quot;px&quot;;};
el.x = startX;
if (verticalpos==&quot;fromtop&quot;)
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function(){
if (verticalpos==&quot;fromtop&quot;){
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(&quot;stayTopLeft()&quot;, 10);
}
ftlObj = ml(&quot;topbar&quot;);
stayTopLeft();
}
if (window.addEventListener)
window.addEventListener(&quot;load&quot;, staticbar, false)
else if (window.attachEvent)
window.attachEvent(&quot;onload&quot;, staticbar)
else if (document.getElementById)
window.onload=staticbar
&lt;/script&gt;
<!-- Java PopUp Final -->

3 - Search for the line <body> and paste the code below it:

<!-- conteudo PopUp Inicio -->
<div id='topbar'>
<p align='right'><a href='' onClick='closebar(); return false'>[Fechar]</a></p>
..... o que desejar colocar na pop-up .....
</div>
<!-- conteudo PopUp Final -->

At the writing ..... what you want to put in pop-up ..... you will put it to appear in the popup can be linked image, text and a box of facebook fans that you can do by clicking here.

Nenhum comentário:

Postar um comentário