1) Crear un nuevo gadget html y poner primer código:
Código 1:
<div id="pop01" class="leightbox">
<div class="scrollbox">
<h1>Bienvenido a Blog Uruguayo</h1>
<p><a href="http://loseasi.blogspot.com/">by Vku.</a></p></div><a href="#" class="lbAction" rel="deactivate">Entrar al Blog</a></div>
<script type="text/javascript">
lb = new lightbox();
lb.initCallable('pop01');
lb.activate();
</script>
Cambiar titulo.
Si se quiere se puede agregar un texto arriba de </div>
2)Ver el nuevo html creado.
3) Ahora nos vamos a edición Html, expandir artilugios y buscamos el html creado. (en el ejemplo es HTML1)
Para buscar apretamos (Ctrl+F) y ponemos HTML1.
4) Un poco mas abajo buscamos:
<div class='widget-content'>
<data:content/>
</div>
Y cambiamos por:
<b:if cond='data:blog.url == data:blog.homepageUrl'>(Estó es para que solo se muestre en la página principal.)
<div class='widget-content'>
<data:content/>
</div></b:if>
5) Ahora nos vamos hasta </head> y justo arriba pegamos el siguiente código:
<!--Bienvenido Página-ENTRAR-->
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<script type='text/javascript'>
//<![CDATA[
/*
Created By: Chris Campbell
Website: http://particletree.com
Date: 2/1/2006
Adaptado y modificado By: Vku.
Website: http://loseasi.blogspot.com/
Date: 23/2/2010
And the lightbox gone wild by ParticleTree at http://particletree.com/features/lightbox-gone-wild/
*/
/*-------------------------------GLOBAL VARIABLES-------------------*/
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
/*--------------------------------------------------------------------------*/
function getBrowserInfo() {
if (checkIt('konqueror')) {
browser = "Konqueror";
OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible')) {
browser = "Netscape Navigator"
version = detect.charAt(8);
}
else browser = "An unknown browser";
if (!version) version = detect.charAt(place + thestring.length);
if (!OS) {
if (checkIt('linux')) OS = "Linux";
else if (checkIt('x11')) OS = "Unix";
else if (checkIt('mac')) OS = "Mac"
else if (checkIt('win')) OS = "Windows"
else OS = "an unknown operating system";
}
}
function checkIt(string) {
place = detect.indexOf(string) + 1;
thestring = string;
return place;
}
/*----------------------------------------------------------------------------*/
Event.observe(window, 'load', initialize, false);
Event.observe(window, 'load', getBrowserInfo, false);
Event.observe(window, 'unload', Event.unloadCache, false);
var lightbox = Class.create();
lightbox.prototype = {
yPos : 0,
xPos : 0,
initialize: function(ctrl) {
if(ctrl) {
this.content = ctrl.rel;
Event.observe(ctrl, 'click', this.activate.bindAsEventListener(this), false);
ctrl.onclick = function(){return false;};
}
},
initCallable: function(rel) {
this.content = rel;
addLightboxMarkup(); //added by richard
},
// Turn everything on - mainly the IE fixes
activate: function(){
if (browser == 'Internet Explorer'){
this.getScroll();
this.prepareIE('100%', 'hidden');
this.setScroll(0,0);
this.hideSelects('hidden');
}
this.displayLightbox("block");
},
// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox
prepareIE: function(height, overflow){
bod = document.getElementsByTagName('body')[0];
bod.style.height = height;
bod.style.overflow = overflow;
htm = document.getElementsByTagName('html')[0];
htm.style.height = height;
htm.style.overflow = overflow;
},
// In IE, select elements hover on top of the lightbox
hideSelects: function(visibility){
selects = document.getElementsByTagName('select');
for(i = 0; i < selects.length; i++) {
selects[i].style.visibility = visibility;
}
},
getScroll: function(){
if (self.pageYOffset) {
this.yPos = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){
this.yPos = document.documentElement.scrollTop;
} else if (document.body) {
this.yPos = document.body.scrollTop;
}
},
setScroll: function(x, y){
window.scrollTo(x, y);
},
displayLightbox: function(display){
$('overlay').style.display = display;
$(this.content).style.display = display;
if(display != 'none') this.actions();
},
// Search through new links within the lightbox, and attach click event
actions: function(){
lbActions = document.getElementsByClassName('lbAction');
for(i = 0; i < lbActions.length; i++) {
Event.observe(lbActions[i], 'click', this[lbActions[i].rel].bindAsEventListener(this), false);
lbActions[i].onclick = function(){return false;};
}
},
// Example of creating your own functionality once lightbox is initiated
deactivate: function(){
if (browser == "Internet Explorer"){
this.setScroll(0,this.yPos);
this.prepareIE("auto", "auto");
this.hideSelects("visible");
}
this.displayLightbox("none");
}
}
/*----------------------------------------------------------------------*/
// Onload, make all links that need to trigger a lightbox active
function initialize(){
addLightboxMarkup();
lbox = document.getElementsByClassName('lbOn');
for(i = 0; i < lbox.length; i++) {
valid = new lightbox(lbox[i]);
}
}
// Add in markup necessary to make this work. Basically two divs:
// Overlay holds the shadow
// Lightbox is the centered square that the content is put into.
function addLightboxMarkup() {
bod = document.getElementsByTagName('body')[0];
overlay = document.createElement('div');
overlay.id = 'overlay';
bod.appendChild(overlay);
}
//]]>
</script>
<style type='text/css'>
div.leightbox {
color: #fff;
display: none; /* piel de la exhibición los popups al diseñar y viendo de antemano */
position: absolute;
top: 50%;
left: 50%;
margin: -240px 0 0 -380px;
width: 750px;
height: 450px;
padding: 0 0 0 5px;
border: 1px solid #FFFFFF;
background: url(http://parquedelplata.webcindario.com/images/pdp5.jpg) no-repeat;
z-index: 7777777;
overflow: none;
}
/*----------close button----------*/
a.lbAction {
padding: 20px 0 0 0;
text-decoration: none;
float: center;
position: absolute;
width: 100%;
height: 40px;
font-size: 35px;
bottom: -70px;
left: 0px;
color: #858585;
border: 1px solid #FFFFFF;
background: #BCC9CF;
z-index: 77777;
}
a.lbAction {
text-align: center;
}
a.lbAction:hover {
color: #000000;
text-align: center;
}
a.lbAction:active {
background: #BCC9CF;
text-align: center;
}
/*----------popup div styling----------*/
div.scrollbox {
position: absolute;
margin: 0 auto;
width: 100%;
height: 100%;
text-align: center;
overflow: auto;
}
div.scrollbox a{
color: #fff;
}
div#overlay {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 77777;
background-color:#B2BDC4;
-moz-opacity: 1.0;
opacity: 1.0;
filter: alpha(opacity=100);
}
div.lightbox[id]{ /* IE6 and below Can't See This */ position:fixed; }
div#overlay[id]{ /* IE6 and below Can't See This */ position:fixed; }
</style>
</b:if>
<!--FIN Bienvenido Página-ENTRAR-->
Cambiar la imagen y el tamaño.
Guardar cambios.
Agregado 04/03/2010
Para que funcione tienen que tener la libreria prototype.
Si no la tienen pegar siguiente código arriba de </head>:
<script src='http://www.google.com/jsapi' type='text/javascript'/>
<script>
google.load("prototype", "1.6.0.3");
google.load("scriptaculous", "1.8.2");
</script>
0 comments:
Post a Comment