sábado, 30 de marzo de 2013

Zoom en imagenes usando jQuery para Blogger

Anterior mente habia publicado como agregar un efecto zoom usando css para una galeria, ante las desventajas de css, les enseñare como agregarle efecto Zoom a las imagenes usando Jquery  de esta manera funcionara en otros navegadores como IE solamente haciendo clic en la iamgen.  Si usas Scriptaculos o otro script no funcionara. por lo que te recomiento ver el siguiente post.

Puedes ver este blogs de pruevas

La verdad esto es muy simple:
solo tienes que agregar antes de </head> el siguiente codigo:


<script type='text/javascript'>
//<![CDATA[
/* jQuery Image Magnify script v1.1
* This notice must stay intact for usage
* Author: Dynamic Drive at http://www.dynamicdrive.com/
* Visit http://www.dynamicdrive.com/ for full source code

* Nov 16th, 09 (v1.1): Adds ability to dynamically apply/reapply magnify effect to an image, plus magnify to a specific width in pixels.
* Feb 8th, 11 (v1.11): Fixed bug that caused script to not work in newever versions of jQuery (ie: v1.4.4)
*/

jQuery.noConflict()

jQuery.imageMagnify={
 dsettings: {
  magnifyby: 3, //default increase factor of enlarged image
  duration: 500, //default duration of animation, in millisec
  imgopacity: 0.2 //opacify of original image when enlarged image overlays it
  },
 cursorcss: 'url(magnify.cur), -moz-zoom-in', //Value for CSS's 'cursor' attribute, added to original image
 zIndexcounter: 100,

 refreshoffsets:function($window, $target, warpshell){
  var $offsets=$target.offset()
  var winattrs={x:$window.scrollLeft(), y:$window.scrollTop(), w:$window.width(), h:$window.height()}
  warpshell.attrs.x=$offsets.left //update x position of original image relative to page
  warpshell.attrs.y=$offsets.top
  warpshell.newattrs.x=winattrs.x+winattrs.w/2-warpshell.newattrs.w/2
  warpshell.newattrs.y=winattrs.y+winattrs.h/2-warpshell.newattrs.h/2
  if (warpshell.newattrs.x<winattrs.x+5){ //no space to the left?
   warpshell.newattrs.x=winattrs.x+5
  }
  else if (warpshell.newattrs.x+warpshell.newattrs.w > winattrs.x+winattrs.w){//no space to the right?
   warpshell.newattrs.x=winattrs.x+5
  }
  if (warpshell.newattrs.y<winattrs.y+5){ //no space at the top?
   warpshell.newattrs.y=winattrs.y+5
  }
 },

 magnify:function($, $target, options){
  var setting={} //create blank object to store combined settings
  var setting=jQuery.extend(setting, this.dsettings, options)
  var attrs=(options.thumbdimensions)? {w:options.thumbdimensions[0], h:options.thumbdimensions[1]} : {w:$target.outerWidth(), h:$target.outerHeight()}
  var newattrs={}
  newattrs.w=(setting.magnifyto)? setting.magnifyto : Math.round(attrs.w*setting.magnifyby)
  newattrs.h=(setting.magnifyto)? Math.round(attrs.h*newattrs.w/attrs.w) : Math.round(attrs.h*setting.magnifyby)
  $target.css('cursor', jQuery.imageMagnify.cursorcss)
  if ($target.data('imgshell')){
   $target.data('imgshell').$clone.remove()
   $target.css({opacity:1}).unbind('click.magnify')
  }
  var $clone=$target.clone().css({position:'absolute', left:0, top:0, visibility:'hidden', border:'1px solid gray', cursor:'pointer'}).appendTo(document.body)
  $clone.data('$relatedtarget', $target) //save $target image this enlarged image is associated with
  $target.data('imgshell', {$clone:$clone, attrs:attrs, newattrs:newattrs})
  $target.bind('click.magnify', function(e){ //action when original image is clicked on
   var $this=$(this).css({opacity:setting.imgopacity})
   var imageinfo=$this.data('imgshell')
   jQuery.imageMagnify.refreshoffsets($(window), $this, imageinfo) //refresh offset positions of original and warped images
   var $clone=imageinfo.$clone
   $clone.stop().css({zIndex:++jQuery.imageMagnify.zIndexcounter, left:imageinfo.attrs.x, top:imageinfo.attrs.y, width:imageinfo.attrs.w, height:imageinfo.attrs.h, opacity:0, visibility:'visible', display:'block'})
   .animate({opacity:1, left:imageinfo.newattrs.x, top:imageinfo.newattrs.y, width:imageinfo.newattrs.w, height:imageinfo.newattrs.h}, setting.duration,
   function(){ //callback function after warping is complete
    //none added 
   }) //end animate
  }) //end click
  $clone.click(function(e){ //action when magnified image is clicked on
   var $this=$(this)
   var imageinfo=$this.data('$relatedtarget').data('imgshell')
   jQuery.imageMagnify.refreshoffsets($(window), $this.data('$relatedtarget'), imageinfo) //refresh offset positions of original and warped images
   $this.stop().animate({opacity:0, left:imageinfo.attrs.x, top:imageinfo.attrs.y, width:imageinfo.attrs.w, height:imageinfo.attrs.h},  setting.duration,
   function(){
    $this.hide()
    $this.data('$relatedtarget').css({opacity:1}) //reveal original image
   }) //end animate
  }) //end click
 }
};

jQuery.fn.imageMagnify=function(options){
 var $=jQuery
 return this.each(function(){ //return jQuery obj
  var $imgref=$(this)
  if (this.tagName!="IMG")
   return true //skip to next matched element
  if (parseInt($imgref.css('width'))>0 && parseInt($imgref.css('height'))>0 || options.thumbdimensions){ //if image has explicit width/height attrs defined
   jQuery.imageMagnify.magnify($, $imgref, options)
  }
  else if (this.complete){ //account for IE not firing image.onload
   jQuery.imageMagnify.magnify($, $imgref, options)
  }
  else{
   $(this).bind('load', function(){
    jQuery.imageMagnify.magnify($, $imgref, options)
   })
  }
 })
};

jQuery.fn.applyMagnifier=function(options){ //dynamic version of imageMagnify() to apply magnify effect to an image dynamically
 var $=jQuery
 return this.each(function(){ //return jQuery obj
  var $imgref=$(this)
  if (this.tagName!="IMG")
   return true //skip to next matched element
 
 })

};


//** The following applies the magnify effect to images with class="magnify" and optional "data-magnifyby" and "data-magnifyduration" attrs
//** It also looks for links with attr rel="magnify[targetimageid]" and makes them togglers for that image

jQuery(document).ready(function($){
 var $targets=$('.magnify')
 $targets.each(function(i){
  var $target=$(this)
  var options={}
  if ($target.attr('data-magnifyto'))
   options.magnifyto=parseFloat($target.attr('data-magnifyto'))
  if ($target.attr('data-magnifyby'))
   options.magnifyby=parseFloat($target.attr('data-magnifyby'))
  if ($target.attr('data-magnifyduration'))
   options.duration=parseInt($target.attr('data-magnifyduration'))
  $target.imageMagnify(options)
 })
 var $triggers=$('a[rel^="magnify["]')
 $triggers.each(function(i){
  var $trigger=$(this)
  var targetid=$trigger.attr('rel').match(/\[.+\]/)[0].replace(/[\[\]']/g, '') //parse 'id' from rel='magnify[id]'
  $trigger.data('magnifyimageid', targetid)
  $trigger.click(function(e){
   $('#'+$(this).data('magnifyimageid')).trigger('click.magnify')
   e.preventDefault()
  })
 })
})


/***********************************************
* jQuery Image Magnify- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

//]]>
</script>


 Pro ultimo para agregar las imagenes, ya sea en un gadget o entrada usa:

<img src="URL DE LA IMAGEN" class="magnify" style="width:150px; height:150px" />

En color Azul esta lo que puedes editar, osea el tamaño de la imagen en pequeño.  Asi de facil podemos agregarle efecto Zoom a nuestras imagenes.

Entradas resumidas en Feedburner de google

Cuando escribimos una entrada por defecto Feedburner de google le manda toda la información de la entrada a nuestros suscriptores, esto nos afecta ya que de esa forma los suscriptores ya no tiene que dirigirse al blogs y creo que la mayoría lo que quieren es que visiten su blogs.


Que podemos hacer?

Bueno para que esto no pase tenemos que configurar nuestro Feedburner para que haga un  resumen de la siguiente manera.

  1. primero abrimos nuestra cuenta de Feedburner, nos dirigimos al feed del blogs que midificaremos.
  2. después hacemos click en Optimize
  3. click en Summary bunner.

y activamos la opción asiendo click en Save, 

Imagen de ejemplo:
 



Galeria de imagenes en miniatura con efecto zoom usando css


Usando CSS y con un poco de creatividad podemos hacer una pequeña Galeria de Imagenes en miniatura, que con solo pasar en cursor sobre la imagen aumenta su tamaño (efecto zoom) sobreponiedoce sebre las demas. esto lo hacemos usardo en comado hover, ademas podemos agregarle estilos de bordes con diferentes propiedades (yo le he colocado una por defecto).
puedes ver un  pequeño en jemplo en este:


Por lo regular las Galerias se agregar ya sea en una paguina o en una entrada por lo que podemos agregar es siguiente codigo es la seccion de HTML de las estradas o paguinas.


<style>
/* Galeria de imagenes*/
.galeri{
background:#0000;
margin-top:5px;
margin-left:5px;
}
.galeri img {
-o-border-radius: 5px;/* radio de borde*/
-ms-border-radius: 55px;/* radio de borde*/
-webkit-border-radius: 5px;/* radio de borde*/
-moz-border-radius: 5px;/* radio de borde*/
border-radius: 5px;
-webkit-box-shadow: 0px 0px 4px #696969;
-moz-box-shadow: 0px 0px 4px #696969;
box-shadow: 0px 0px 4px #696969;
padding: 5px;
position:static;
}
.galeri img:hover {
-o-border-radius: 5px;/* radio de borde*/
-ms-border-radius: 5px;/* radio de borde*/
-webkit-border-radius: 5px;/* radio de borde*/
-moz-border-radius: 5px;/* radio de borde*/
border-radius: 5px;
-webkit-box-shadow: 0px 0px 4px #696969;
-moz-box-shadow: 0px 0px 4px #696969;
box-shadow: 0px 0px 4px #696969;
-webkit-transition:all .8s ease;
-o-transition:all .8s ease;
-moz-transition:all .8s ease;
-ms-transition:all .8s ease;
transition:all .8s ease;
width: 50%;/*tamaño de imagen al pasar en cursor*/
height:50%;/*tamaño de imagen al pasar en cursor*/
float:center;
position:absolute;
padding: 5px;
margin-top:-15%;/*posicion de arriba a abajo al pasar el cursor*/
margin-left:-25%;/*posicion de izquierda a derecha al pasar el cursor */
}

</style>

<div class="galeri">
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>

</div>
<div class="galeri">
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="h#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>

</div>
<div class="galeri">
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>
</div>
Si quieres agregar otra imagen en cualquier columna simplemente agregar:

<a href="#"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9ZSh9vKfJ-glb_iAC3oxMTDDxeCSJN05xkNbcK-iJi6W22J9IdhCa5XKZTtZ_4cqAOMnpuXTyhs77klMdARB1zu4Dmg8jZ3tfiqn0ipWi_2zI9iktxMDxTzOPVy6Ptph_zyhh2htKv_0/s1600/Paisajes-de-Mar.jpg" height="125px" width="125px" /></a>

En cualquier parte dentro de: ( no tienes que agregar lo de negro de nuevo, simplemente agrega dentro de el codigo de la imagen nueva)
<div class="galeri"> Aqui codigo de arriba con el url de la nueva imagen </div>


 y si quieres agregar otra fila, simplemente pega todo el codigo:( incluyendo lo de azul)

<div class="galeri"> Aqui codigo de todas la imagenes de la nueva fila </div>

Como lo vez es Facil agregar esta Galeria, una de las desventajas es que no tendra en efecto Zoom en navegadores modernos y nucho menos en IE.


Menú horizontal flotante que se expande al pasar en cursor


En estos días he estado jugando un poco con CSS3, y bueno se me ocurrió hacer un menú horizontal usando únicamente CSS3, esto para no hace que nuestro blogs se cargue mucho de script, a diferencia de muchos menús que ya has visto, (espero no allás visto ya uno igual) este menú estará flotando y oculto momentaneamente en nuestro blogs de tal manera que con solo pasar en cursor sobre la en botón "menú"se expande mostrando todas las opciones de nuestro menú, como si fuera una armónica (al menos yo así lo veo), y por si fuera poco le he agregado un ángulo de rotación de -30 grados para darle mas elegancia, claro que todo esto lo puedes editar puedes ver el ejemplo: que flota en tutoblogger o en la imagen de arriba.

Para agregar este menú a nuestro blogs ve a la Edición HTML de tu blog y antes de ]]></b:skin> y pega lo siguiente:



ul.menuflotante {
position: relative;
width: 100%;
margin: 20px auto;
text-align: center;
list-style-type: none;
font-family: "Arial";
font-size: 13pt;/* tamaño de letras*/
color: white;
}
ul.menuflotante li {
display: inline;
margin: 0;
padding: 0;
}
ul.menuflotante li a {
-o-border-radius: 5px;/* radio de borde*/
-ms-border-radius: 5px;/* radio de borde*/
-webkit-border-radius: 5px;/* radio de borde*/
-moz-border-radius: 5px;/* radio de borde*/
border-radius: 5px;
-webkit-box-shadow: 0px 0px 4px #696969;
-moz-box-shadow: 0px 0px 4px #696969;
box-shadow: 0px 0px 4px #696969;
padding: 5px;
position: absolute;
opacity: 0;
display: inline-block;
left: 50%;
margin-left: -50px;
text-decoration: none;
color: white;
background:#e51431;/* Color de botones*/
width:100px;/*ancho de botones */
height:70px;/* alto de botones*/
transition: all .8s ease;
}
ul.menuflotante li:last-of-type a {
opacity: 1;
}
ul.menuflotante a span {
position: relative;
top:40%;
padding: 5px;
text-align: center;
}
ul.menuflotante:hover li a {
color: white;
background:#e51431 ;
opacity: 1;
-webkit-transition:all .8s ease;
-o-transition:all .8s ease;
-moz-transition:all .8s ease;
-ms-transition:all .8s ease;
transition:all .8s ease;
}

ul.menuflotante:hover li:nth-of-type(1) a {
margin-left: -50px;/*posicion del boton 1*/
}
ul.menuflotante:hover li:nth-of-type(2) a {
margin-left: 50px;/*posicion del boton 2*/
}
ul.menuflotante:hover li:nth-of-type(3) a {
margin-left: 150px;/*posicion del boton 3*/
}
ul.menuflotante:hover li:nth-of-type(4) a {
margin-left: 250px;/* posicion del boton 4*/
}
ul.menuflotante:hover li:nth-of-type(5) a {
margin-left: 350px;/* posicion del boton 5*/
}
ul.menuflotante:hover li:last-of-type a {
opacity: 0;
top: -1000px;/* posicion del boton menu*/
}
ul.menuflotante a:hover {
transform: rotate(-30deg);/* angulo de rotacion*/
}
#flotador {
position:fixed;
bottom:100px;
left:60px;
}
/* menu flotante creado por tutoblogger*/

Ahora en Diseño,ve a Añadir Gadget,HTML/Javascript y pega lo siguiente:
<div id="flotador">
<ul class="menuflotante">
<li><a href="Url de Enlace">Inicio</a></li>
<li><a href="Url de Enlace">Mapa del blogs</a></li>
<li><a href="Url de Enlace">Contacto</a></li>
<li><a href="Url de Enlace">Enlazanos</a></li>
<li><a href="Url de Enlace">sobre nosotros</a></li>
<li><a href="#">Menu</a></li>
</ul>
</div> 


guardas los cambios y listo. toma en cuanta que este menú se vera bien usando navegadores resientes, y claro no funciona con IE. Lo que se encuentra en rojo y azul pueden editar.


Descripcion en imagenes con efecto deslizante usando css

Una forma de agregarle mas estilo a nuestras imágenes y hacer que nuestro blogs sea mas profesional, es poniendo una pequeña descripc...