Hoy les traigo un slideshow de imágenes muy vistoso, bonito y fácil de instalar en nuestro blog.
( ↪DEMO)
El slider se llama
Nivo y a continuación les enseñaré cómo instalarlo:
1.§ Vamos a Plantilla - Edición de HTML; si usamos a antigua interfaz de Blogger, vamos a Diseño - Edición de HTML.
2.§ Lo que haremos será agregar la libreria jQuery, claro que si ya la tenemos en nuestra plantilla no será necesario agregarla nuevamente. Si no la tenemos, entonces haremos lo siguiente: buscamos la etiqueta
</head> y antes de éste, pegamos el siguiente código:
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'/>
3.§ Debajo del código anterior, pegaremos el siguiente script de Nivo Slider o si gustan pueden guardalo en un documento y subirlo en algún alojamiento:
<script type='text/javascript'>
//<![CDATA[
/*
* jQuery Nivo Slider v2.3
* http://nivo.dev7studios.com
* Copyright 2010, Gilbert Pellegrom
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function(b){var a=function(j,q){var g=b.extend({},b.fn.nivoSlider.defaults,q);var m={currentSlide:0,currentImage:"",totalSlides:0,randAnim:"",running:false,paused:false,stop:false};var d=b(j);d.data("nivo:vars",m);d.css("position","relative");d.addClass("nivoSlider");var e=d.children();e.each(function(){var t=b(this);var s="";if(!t.is("img")){if(t.is("a")){t.addClass("nivo-imageLink");s=t}t=t.find("img:first")}var r=t.width();if(r==0){r=t.attr("width")}var i=t.height();if(i==0){i=t.attr("height")}if(r>d.width()){d.width(r)}if(i>d.height()){d.height(i)}if(s!=""){s.css("display","none")}t.css("display","none");m.totalSlides++});if(g.startSlide>0){if(g.startSlide>=m.totalSlides){g.startSlide=m.totalSlides-1}m.currentSlide=g.startSlide}if(b(e[m.currentSlide]).is("img")){m.currentImage=b(e[m.currentSlide])}else{m.currentImage=b(e[m.currentSlide]).find("img:first")}if(b(e[m.currentSlide]).is("a")){b(e[m.currentSlide]).css("display","block")}d.css("background","url("+m.currentImage.attr("src")+") no-repeat");for(var k=0;k<g.slices;k++){var o=Math.round(d.width()/g.slices);if(k==g.slices-1){d.append(b('<div class="nivo-slice"></div>').css({left:(o*k)+"px",width:(d.width()-(o*k))+"px"}))}else{d.append(b('<div class="nivo-slice"></div>').css({left:(o*k)+"px",width:o+"px"}))}}d.append(b('<div class="nivo-caption"><p></p></div>').css({display:"none",opacity:g.captionOpacity}));if(m.currentImage.attr("title")!=""){var n=m.currentImage.attr("title");if(n.substr(0,1)=="#"){n=b(n).html()}b(".nivo-caption p",d).html(n);b(".nivo-caption",d).fadeIn(g.animSpeed)}var c=0;if(!g.manualAdvance&&e.length>1){c=setInterval(function(){p(d,e,g,false)},g.pauseTime)}if(g.directionNav){d.append('<div class="nivo-directionNav"><a class="nivo-prevNav">Prev</a><a class="nivo-nextNav">Next</a></div>');if(g.directionNavHide){b(".nivo-directionNav",d).hide();d.hover(function(){b(".nivo-directionNav",d).show()},function(){b(".nivo-directionNav",d).hide()})}b("a.nivo-prevNav",d).live("click",function(){if(m.running){return false}clearInterval(c);c="";m.currentSlide-=2;p(d,e,g,"prev")});b("a.nivo-nextNav",d).live("click",function(){if(m.running){return false}clearInterval(c);c="";p(d,e,g,"next")})}if(g.controlNav){var l=b('<div class="nivo-controlNav"></div>');d.append(l);for(var k=0;k<e.length;k++){if(g.controlNavThumbs){var f=e.eq(k);if(!f.is("img")){f=f.find("img:first")}if(g.controlNavThumbsFromRel){l.append('<a class="nivo-control" rel="'+k+'"><img src="'+f.attr("rel")+'" alt="" /></a>')}else{l.append('<a class="nivo-control" rel="'+k+'"><img src="'+f.attr("src").replace(g.controlNavThumbsSearch,g.controlNavThumbsReplace)+'" alt="" /></a>')}}else{l.append('<a class="nivo-control" rel="'+k+'">'+(k+1)+"</a>")}}b(".nivo-controlNav a:eq("+m.currentSlide+")",d).addClass("active");b(".nivo-controlNav a",d).live("click",function(){if(m.running){return false}if(b(this).hasClass("active")){return false}clearInterval(c);c="";d.css("background","url("+m.currentImage.attr("src")+") no-repeat");m.currentSlide=b(this).attr("rel")-1;p(d,e,g,"control")})}if(g.keyboardNav){b(window).keypress(function(i){if(i.keyCode=="37"){if(m.running){return false}clearInterval(c);c="";m.currentSlide-=2;p(d,e,g,"prev")}if(i.keyCode=="39"){if(m.running){return false}clearInterval(c);c="";p(d,e,g,"next")}})}if(g.pauseOnHover){d.hover(function(){m.paused=true;clearInterval(c);c=""},function(){m.paused=false;if(c==""&&!g.manualAdvance){c=setInterval(function(){p(d,e,g,false)},g.pauseTime)}})}d.bind("nivo:animFinished",function(){m.running=false;b(e).each(function(){if(b(this).is("a")){b(this).css("display","none")}});if(b(e[m.currentSlide]).is("a")){b(e[m.currentSlide]).css("display","block")}if(c==""&&!m.paused&&!g.manualAdvance){c=setInterval(function(){p(d,e,g,false)},g.pauseTime)}g.afterChange.call(this)});var p=function(r,s,u,x){var y=r.data("nivo:vars");if(y&&(y.currentSlide==y.totalSlides-1)){u.lastSlide.call(this)}if((!y||y.stop)&&!x){return false}u.beforeChange.call(this);if(!x){r.css("background","url("+y.currentImage.attr("src")+") no-repeat")}else{if(x=="prev"){r.css("background","url("+y.currentImage.attr("src")+") no-repeat")}if(x=="next"){r.css("background","url("+y.currentImage.attr("src")+") no-repeat")}}y.currentSlide++;if(y.currentSlide==y.totalSlides){y.currentSlide=0;u.slideshowEnd.call(this)}if(y.currentSlide<0){y.currentSlide=(y.totalSlides-1)}if(b(s[y.currentSlide]).is("img")){y.currentImage=b(s[y.currentSlide])}else{y.currentImage=b(s[y.currentSlide]).find("img:first")}if(u.controlNav){b(".nivo-controlNav a",r).removeClass("active");b(".nivo-controlNav a:eq("+y.currentSlide+")",r).addClass("active")}if(y.currentImage.attr("title")!=""){var z=y.currentImage.attr("title");if(z.substr(0,1)=="#"){z=b(z).html()}if(b(".nivo-caption",r).css("display")=="block"){b(".nivo-caption p",r).fadeOut(u.animSpeed,function(){b(this).html(z);b(this).fadeIn(u.animSpeed)})}else{b(".nivo-caption p",r).html(z)}b(".nivo-caption",r).fadeIn(u.animSpeed)}else{b(".nivo-caption",r).fadeOut(u.animSpeed)}var w=0;b(".nivo-slice",r).each(function(){var i=Math.round(r.width()/u.slices);b(this).css({height:"0px",opacity:"0",background:"url("+y.currentImage.attr("src")+") no-repeat -"+((i+(w*i))-i)+"px 0%"});w++});if(u.effect=="random"){var A=new Array("sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade");y.randAnim=A[Math.floor(Math.random()*(A.length+1))];if(y.randAnim==undefined){y.randAnim="fade"}}if(u.effect.indexOf(",")!=-1){var A=u.effect.split(",");y.randAnim=b.trim(A[Math.floor(Math.random()*A.length)])}y.running=true;if(u.effect=="sliceDown"||u.effect=="sliceDownRight"||y.randAnim=="sliceDownRight"||u.effect=="sliceDownLeft"||y.randAnim=="sliceDownLeft"){var t=0;var w=0;var C=b(".nivo-slice",r);if(u.effect=="sliceDownLeft"||y.randAnim=="sliceDownLeft"){C=b(".nivo-slice",r)._reverse()}C.each(function(){var i=b(this);i.css("top","0px");if(w==u.slices-1){setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;w++})}else{if(u.effect=="sliceUp"||u.effect=="sliceUpRight"||y.randAnim=="sliceUpRight"||u.effect=="sliceUpLeft"||y.randAnim=="sliceUpLeft"){var t=0;var w=0;var C=b(".nivo-slice",r);if(u.effect=="sliceUpLeft"||y.randAnim=="sliceUpLeft"){C=b(".nivo-slice",r)._reverse()}C.each(function(){var i=b(this);i.css("bottom","0px");if(w==u.slices-1){setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;w++})}else{if(u.effect=="sliceUpDown"||u.effect=="sliceUpDownRight"||y.randAnim=="sliceUpDown"||u.effect=="sliceUpDownLeft"||y.randAnim=="sliceUpDownLeft"){var t=0;var w=0;var B=0;var C=b(".nivo-slice",r);if(u.effect=="sliceUpDownLeft"||y.randAnim=="sliceUpDownLeft"){C=b(".nivo-slice",r)._reverse()}C.each(function(){var i=b(this);if(w==0){i.css("top","0px");w++}else{i.css("bottom","0px");w=0}if(B==u.slices-1){setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;B++})}else{if(u.effect=="fold"||y.randAnim=="fold"){var t=0;var w=0;b(".nivo-slice",r).each(function(){var i=b(this);var v=i.width();i.css({top:"0px",height:"100%",width:"0px"});if(w==u.slices-1){setTimeout(function(){i.animate({width:v,opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({width:v,opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;w++})}else{if(u.effect=="fade"||y.randAnim=="fade"){var w=0;b(".nivo-slice",r).each(function(){b(this).css("height","100%");if(w==u.slices-1){b(this).animate({opacity:"1.0"},(u.animSpeed*2),"",function(){r.trigger("nivo:animFinished")})}else{b(this).animate({opacity:"1.0"},(u.animSpeed*2))}w++})}}}}}};var h=function(i){if(this.console&&typeof console.log!="undefined"){console.log(i)}};this.stop=function(){if(!b(j).data("nivo:vars").stop){b(j).data("nivo:vars").stop=true;h("Stop Slider")}};this.start=function(){if(b(j).data("nivo:vars").stop){b(j).data("nivo:vars").stop=false;h("Start Slider")}};g.afterLoad.call(this)};b.fn.nivoSlider=function(c){return this.each(function(){var d=b(this);if(d.data("nivoslider")){return}var e=new a(this,c);d.data("nivoslider",e)})};b.fn.nivoSlider.defaults={effect:"random",slices:15,animSpeed:500,pauseTime:3000,startSlide:0,directionNav:true,directionNavHide:true,controlNav:true,controlNavThumbs:false,controlNavThumbsFromRel:false,controlNavThumbsSearch:".jpg",controlNavThumbsReplace:"_thumb.jpg",keyboardNav:true,pauseOnHover:true,manualAdvance:false,captionOpacity:0.8,beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};b.fn._reverse=[].reverse})(jQuery);
//]]>
</script>
<script type='text/javascript'>
jQuery(window).load(function() {
jQuery('#slider').nivoSlider();
});
</script>
4.§ Para agregar los estilos CSS, buscamos ]]></b:skin> y encima de éste pegaremos el siguiente código:
#slider-container {
width: 940px;
height: 380px;
background: #FFF;
margin-bottom: 15px;}
.nivoSlider {
position:relative;}
.nivoSlider img {
position:absolute;
top:0px;
left:0px;}
.nivoSlider a.nivo-imageLink {
position:absolute;
top:0px;
left:0px;
width:100%;
height:100%;
border:0;
padding:0;
margin:0;
z-index:60;
display:none;}
.nivo-slice {
display:block;
position:absolute;
z-index:50;
height:100%;}
.nivo-caption {
position:absolute;
right:0px;
top:250px;
background: #ffffff; /*color del rectángulo transparente*/
color:#DF7BDA;
opacity:0.8;
width: 100%;
z-index:89;
display: inline;}
.nivo-caption p {
padding:3px;
margin:0;
font-size: 20px;
color: #DF7BDA; /*para modificar color del texto*/
text-align: right;
font-family: 'PT Sans', Helvetica, Arial;
}
.nivo-caption a {
display:inline !important;
color: #DF7BDA;}
.nivo-html-caption {
display:none;}
.nivo-directionNav a {
display:none;
position:absolute;
top:45%;
z-index:99;
cursor:pointer;}
.nivo-prevNav {
left:0px;}
.nivo-nextNav {
right:0px;}
.nivo-controlNav a {
position:
relative;
z-index:99;
cursor:pointer;}
.nivo-controlNav a.active {
font-weight:bold;}
#slider {
float: left;
position:relative;
width:600px;
height:300px;
background: #000 url(http://img833.imageshack.us/img833/4175/loadingpy.gif) no-repeat 50% 50%;
}
#slider img {
position:absolute;
top:0px;
left:0px;
display:none;
}
#slider a {
border:0;
display:block;
}
.nivo-controlNav {
position:absolute;
left:230px;
bottom:-40px;
}
.nivo-controlNav a {
width:22px;
height: 22px;
background: url(http://3.bp.blogspot.com/-uY-843TxLu4/T3D3Bk4mxoI/AAAAAAAABfo/CL-VgavJWxk/s000/bullets.png) no-repeat;
text-indent:-9999px;
border:0;
margin-right:7px;
float:left;
}
.nivo-controlNav a.active {
background-position:0 -22px;
}
.nivo-directionNav a {
display:none;
height:0px;
background:url no-repeat;
text-indent:-9999px;
border:0;
}
a.nivo-nextNav {
background-position: -30px 0;
right:15px;
}
a.nivo-prevNav {
left:15px;
}
.nivo-caption {
text-shadow:none;
}
.nivo-caption a {
color:#000;
text-decoration:underline;
}
5.§ Finalmente, para agregar las imágenes del slide, armaremos el siguiente HTML en el lugar donde queramos agregarlo (debajo de la cabecera, antes del footer, etc) :
<div id='slider'>
<a href='#' title=''><img alt='' src='imagen.jpg' title=''/></a>
<a href='#' title=''><img alt='' src='imagen.jpg' title=''/></a>
<a href='#' title=''><img alt='' src='imagen.jpg' title=''/></a>
<a href='#' title=''><img alt='' src='imagen.jpg' title=''/></a>
</div>
6.§ Vamos a vista previa y si todo está bien le damos a Guardar. Ahora pueden modificarlo a su gusto. En la página web del slide podrán ver todos los efectos que pueden agregarse.
Video tutorial
También les dejo el tutorial en forma de video:
Nivo Slider
32 opinaron:
Me encanta! ya lo probaré :D
Besos!
» Graciela:
Qué bueno que te gustó !
S@lu2<
El Slider se ve súper. Lo agregaré !
» G:
Seguro quedará lindo en tu blog.
S@lu2
Este slider está buenísimo.
» Juan Carlos P:
Qué bueno que te gustó, gracias poe el comentario !
S@lu2
este slideshow se ve relamente lindo, quiero agregarlo a mi blog pero como no tengo mucha experiencia en el tema de los odigos, no se si fuese posible que hagas un video de este tutorial, seria genial.
espero que se pueda hacer (:
» squirrel:
Espero que te haya sido de yuda el tutorial :)
S@lu2
La imagen se queda cargando eternamente, no me funciona. T^T
Gracias de todas formas, tienes un blog muy bonito.
» Nifeno:
El problema persiste o lo pudiste solucionar, para ayudarte .
S@lu2
Creo que el problema es que no explicas dónde tiene que ir la url del enlace y de la imagen.
» Madrid Suena:
Sí lo menciono tanto en el video tutorial como en la entrada.
En el paso 5.§ hay una caja de código. La url del enlace se coloca en lugar de # y la url de la imagen se coloca donde dice imagen.jpg
Si necesitas alguna ayuda para colocar el slide, no dudes en avisarme.
S@lu2
Utilísimo y funciona a la primera, ¡muchísimas gracias!
» Rosario T. Palacios:
Gracias a ti por la visita y por el comentario.
S@lu2
oie! como puedo agregarlo mediante block de notas esq no encuentro la etiqeta ]]>
oie! como puedo agregarlo mediante block de notas esq no encuentro la etiqeta ]]>
como puedo cambiar la posición de la barra de los títulos, para bajarla un poco,gracias
» Alberto García Mónica González:
Para ello busca esta porción de código del CSS:
.nivo-caption {
position:absolute;
right:0px;
top:250px;
background: #ffffff; /*color del rectángulo transparente*/
color:#DF7BDA;
opacity:0.8;
width: 100%;
z-index:89;
display: inline;}
El valor que está resaltado en negrita (top:250px;) es el valor que debes modificar si quieres subir o bajar la parte del título. Si le bajas el valor, la barra estará arríba. Si el valor aumenta, la barra estará en la parte inferior.
S@lu2
Hice todo lo que tu has dicho pero no consegui poner mi slideshow...
Me podrias pasar tu html de las imágenes de tu slide???
Asi copio y pego y veo en que estoy fallando.
Gracias.
Mi pagina es angusbellasombra.com
Quiero poner un slide en la entrada principal.
Slds.
» Gaston Sanchez:
Claro, te lo dejo, pero es el mismo que está en el tutorial:
<div id='slider'><a href='#' title='Tengo tu mismo color...'><img alt='' src='http://1.bp.blogspot.com/-nF--CX7CuAs/T3JDfR53TiI/AAAAAAAABf0/p1eDLLNMynE/s000/coffee1.jpg' title='Tengo tu mismo color...'/></a><a href='#' title='...y tu misma procedencia...'><img alt='' src='http://3.bp.blogspot.com/-SYY7Rq178iE/T3JDgPuyQzI/AAAAAAAABgM/ZA5JqvSH92o/s00/coffee3.jpg' title='...y tu misma procedencia...'/></a><a href='#' title='Somos aroma y esencia...'><img alt='' src='http://2.bp.blogspot.com/-RIrRPC0ZjWA/T3JDfjiD2_I/AAAAAAAABgA/SSgtgpzhCAA/s000/coffee2.jpg' title='Somos aroma y esencia...'/></a><a href='#' title='...y amargo es nuestro sabor.'><img alt='' src='http://4.bp.blogspot.com/-HS_lxhvIl2E/T3JDgTQW-OI/AAAAAAAABgY/po8UuAvItRE/s000/coffee4.jpg' title='...y amargo es nuestro sabor.'/></a></div>
S@lu2
gracias por el post esta muy clarito solo que no visualizo las imagenes por completo,a que se debe al css? este es mi blog nelytapersex.blogspot.com
Hola, sabes que segui cada paso de tu tutorial, incluso puse el /head separado del los codigos, el skin lo puse unido como sale en el video junto al codigo pero resulta que no me funcióna, vi 2 veces el video! incluso en el gadget probé con tu mismo codigo de imagenes pero igual me sale el circulito de cargando y no me sale ninguna imagen! ayuda
Estoy seguro que es un problema de la plantilla HTML pero nose donde porque hice todo pero todo igual! tal ves deva agregar un codigo pequeño especial nose, porfavor ayudame... Gracias
» Alexx888:
Tendría que revisar tu plantilla para ver qué está sucediendo.
Si seguiste todos los pasos y no te funciona, envíame una copia de tu plantilla. Descárgala siguiendo las instrucciones de
este post y envíame el archivo a mi correo que encontrarás en la parte superior izquierda (donde dice Contacto).
S@lu2
HOlaa, el slideshow no me sale centrado, sino que alineado a la izquierda que sera?
» marcos rodriguez:
Pásame el link de tu blog para revisarlo y ayudarte.
S@lu2
solo una pregunta: Como controlas la velocidad del slide?
como se hace pra cambiar de imagenes¿?
» Julie Tisdale:
En el paso 5.§ reemplaza "imagen.jpg" por la URL de tu imagen.
S@lu2
ESTIMADA EXCELENTE BLOG Y MUY BUEN APORTE.
CONSULTA: COMO HAGO PARA QUE AL PRESIONAR EN LAS IMÁGENES ME LLEVE A UNA PAGINA DISTINTA, PERO EN UNA NUEVA PESTAÑA Y NO QUE CAMBIE LA ACTUAL POR OTRA.
Tengo un problema! No puedo abrir el segundo codigo HTML, el que pone "Ver SCRIPT"... Que hago? Me lo puedes pasar?
Hola de nuevo!
Ya he conseguido ver el codigo... pero ahora en mi plantilla no tengo esta parte "]]>", me dice cuando la busco que no esta. Hay alguna solución?
hola,he intentado hacerlo y no me sale,donde tiene q ir el slider me salen los numeros 1234,no me salen imagenes,me puedes ayudar?
Por favor, trata de tener habilitado tu perfil (has click en "Comenta con el antiguo editor" para iniciar sesión) o deja un enlace a tu blog escogiendo la opción "Nombre/URL", procura no dejar comentarios Anónimos.
Nota: Si es que se presenta algún problema con el formulario de comentarios, sólo has click en "Comenta con el antiguo editor"
Gracias por participar en el blog.