Delicious LinkedIn Facebook Twitter RSS Feed
Showing posts with label Scriptaculous. Show all posts
Showing posts with label Scriptaculous. Show all posts

Efecto deslizante en un link de texto o imagen

Para este efecto hay que tener las librerías Prototype y Scriptaculous.

Si no la tenemos. Vamos a Diseño, Edición de HTML y justo arriba de </head>

Poner el siguiente código:

<script src='http://www.google.com/jsapi' type='text/javascript'/>
<script>

google.load(&quot;prototype&quot;, &quot;1.6.0.3&quot;);
google.load(&quot;scriptaculous&quot;, &quot;1.8.2&quot;);
</script>

Después para darle el efecto solo agregar la siguiente línea a los link:

onMouseOver='new Effect.Shake(this, {distance:10, duration:1.5});'

Pueden modificar la distancia (distance:10) y duración (duration:1.5) del efecto.


Ejemplo en link de texto:

<a href='http://.....URL......com/' onMouseOver='new Effect.Shake(this, {distance:10, duration:1.5});'>LINK</a>


Ejemplo en link de una imagen:

<a href='http://.....URL......com/' onMouseOver='new Effect.Shake(this, {distance:10, duration:1.5});'><img src="URL IMAGEN"/></a>


Si tienen la librería llamada jQuery no utilizar Scriptaculous ni este efecto.

Efecto pulsante en un link de texto o imagen

Para este efecto hay que tener las librerías Prototype y Scriptaculous.

Si no la tenemos. Vamos a Diseño, Edición de HTML y justo arriba de </head>

Poner el siguiente código:

<script src='http://www.google.com/jsapi' type='text/javascript'/>
<script>
google.load(&quot;prototype&quot;, &quot;1.6.0.3&quot;);
google.load(&quot;scriptaculous&quot;, &quot;1.8.2&quot;);
</script>

Después para darle el efecto solo agregar la siguiente línea a los link:

onMouseOver='new Effect.Pulsate(this);'

Ejemplo en link de texto:

<a href='http://.....URL......com/' onMouseOver='new Effect.Pulsate(this);'>LINK</a>


Ejemplo en link de una imagen:

<a href='http://.....URL......com/' onMouseOver='new Effect.Pulsate(this);'><img src="URL IMAGEN"/></a>


Si tienen la librería llamada jQuery no utilizar Scriptaculous ni este efecto.

Ir arriba, centro y abajo con efecto Jquery o Scriptaculous


Se trata de poner unas imágenes en la parte de abajo sobre la derecha de nuestro blog, para darle la posibilidad a nuestros visitantes que se desplacen mas facilmente por nuestro blog.

El siguiente código lo pegamos abajo de <body>:

<!-- ir arriba,centro y abajo -->
<a href='#outer-wrapper'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBQZ0L0HuTmlTDdYc_eqWKRSPvSt1ZvNkSWlDxKcL6J2Ifu53R2PviMq8aS-C-371ro2zQzcmBiBOaKCKdLGo_FAA2mgM9Pot4D7j9cY3qkd2CJa2U1Kj0Ia2UXv9_t4zn12_UMBBBxW4G/s1600/arriba.png' style='position:fixed; bottom:75px; right:10px;' title='Ir arriba'/></a>

<a href='#centro'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7r0Ju8Cn4vU7JZ331trrD8g7PDq_sMo-MOB5gtPquWLNv1svDrHSHewuKeweQ-yd5Asl9L_PccmSSJAUgDHmC9zErmPMnq4OoLbmDuqgXVLlxlHI4wpEF1KPfZUET9ZB3CtpsJ7K2unaT/s1600/centro.png' style='position:fixed; bottom:45px; right:10px;' title='Ir centro'/></a>

<a href='#footer-wrapper'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrXvLIPRj5zElLdDV9GwO9EkHd-wS49siz0Hv6jWGFvu5EqfMzeh8jRvx0bipuIYIQl2yscVfqdBJGBeOMcKwlsRCANMNt3Qa5FPsIB2ah8clvsdzQII2agtPAF3G9jFDx5cWQFWRR10wy/s1600/abajo.png' style='position:fixed; bottom:10px; right:10px;' title='Ir abajo'/></a>
<!-- fin ir arriba,centro y abajo -->

Luego pegamos el siguiente código dentro de <body> y </body>, yo lo coloque en medio de la sidebar.

<a id='centro'/>

Ejemplo en mi plantilla (hacer la prueba):

<b:widget id='HTML14' locked='false' title='' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != &quot;&quot;'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
<a id='centro'/>
<b:widget id='HTML9' locked='false' title='Ultimos Comentarios...' type='HTML'>
<b:includable id='main'>

Ahora modificar a gusto el código cambiando las imágenes y si es necesario la posición.

Guardar cambios.

Ya tenemos nuestras imágenes  o flechas en el blog.

Ahora si queremos darle un efecto de suavidad al deslizar, se puede hacer con Jquery o Scriptaculous.

Efecto con Jquery: (Ver ejemplo acá:)

Tenemos que pegar 2 códigos justo arriba de </head>.

Código 1: (OJO si ya lo tienen en la plantilla no es necesario repetirlo.)

<!-- jquery-->
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js' type='text/javascript'/>
<!-- fin jquery-->

Código 2:

<!-- ir arriba,centro y abajo -->
<script type='text/javascript'>
//<![CDATA[
jQuery(document).ready(function(){
jQuery('a[href*=#]').click(function() {
var name = jQuery(this).attr('href');
var no = new Array ('#mas', '#mas');
var total = no.length;
var desplazamiento = 2500;

for (i=0;i<=total;i++) {
if(no[i] == name){
return false;
}
}

if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var target = jQuery(this.hash);
target = target.length && target

|| jQuery('[href=' + this.hash.slice(1) +']');
if (target.length) {
var targetOffset = target.offset().top;
jQuery('html,body')
.animate({scrollTop: targetOffset}, desplazamiento);
return false;
}}
});
});
//]]>
</script>
<!-- fin ir arriba,centro y abajo -->

Guardar cambios.

Efecto con Scriptaculous: (Ver ejemplo en mi blog)

Tenemos que pegar el siguiente código justo arriba de </head>.

Código: (OJO si ya lo tienen en la plantilla no es necesario repetirlo.)

<!-- prototype y scriptaculous-->
<script src='http://www.google.com/jsapi'/>
<script>
google.load(&quot;prototype&quot;,&quot;1.6.0.3&quot;);
google.load(&quot;scriptaculous&quot;, &quot;1.8.2&quot;);
</script>
<!-- fin prototype y scriptaculous-->

Ahora modificaremos un poco el primer código que colocaron arriba de <body>.

Hay que agregar unas lineas al código.

El código seria así:

<!-- ir arriba,centro y abajo -->
<a href='#outer-wrapper'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBQZ0L0HuTmlTDdYc_eqWKRSPvSt1ZvNkSWlDxKcL6J2Ifu53R2PviMq8aS-C-371ro2zQzcmBiBOaKCKdLGo_FAA2mgM9Pot4D7j9cY3qkd2CJa2U1Kj0Ia2UXv9_t4zn12_UMBBBxW4G/s1600/arriba.png' style='position:fixed; bottom:75px; right:10px;' title='Ir arriba'/></a>

<a href='#centro'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7r0Ju8Cn4vU7JZ331trrD8g7PDq_sMo-MOB5gtPquWLNv1svDrHSHewuKeweQ-yd5Asl9L_PccmSSJAUgDHmC9zErmPMnq4OoLbmDuqgXVLlxlHI4wpEF1KPfZUET9ZB3CtpsJ7K2unaT/s1600/centro.png' style='position:fixed; bottom:45px; right:10px;' title='Ir centro'/></a>

<a href='#footer-wrapper'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrXvLIPRj5zElLdDV9GwO9EkHd-wS49siz0Hv6jWGFvu5EqfMzeh8jRvx0bipuIYIQl2yscVfqdBJGBeOMcKwlsRCANMNt3Qa5FPsIB2ah8clvsdzQII2agtPAF3G9jFDx5cWQFWRR10wy/s1600/abajo.png' style='position:fixed; bottom:10px; right:10px;' title='Ir abajo'/></a>
<!-- fin ir arriba,centro y abajo -->

Ahora le agregamos la siguiente linea para darle el efecto:

onclick='new Effect.ScrollTo("outer-wrapper",{offset:-150}); return false'

outer-wrapper se cambia en cada link por la id asignada:
  • "outer-wrapper"
  • "centro";
  • "footer-wrapper"
Quedaria así:

<!-- ir arriba,centro y abajo -->
<a href='#outer-wrapper' onclick='new Effect.ScrollTo("outer-wrapper",{offset:-150}); return false'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBQZ0L0HuTmlTDdYc_eqWKRSPvSt1ZvNkSWlDxKcL6J2Ifu53R2PviMq8aS-C-371ro2zQzcmBiBOaKCKdLGo_FAA2mgM9Pot4D7j9cY3qkd2CJa2U1Kj0Ia2UXv9_t4zn12_UMBBBxW4G/s1600/arriba.png' style='position:fixed; bottom:75px; right:10px;' title='Ir arriba'/></a>

<a href='#centro' onclick='new Effect.ScrollTo("centro",{offset:-150}); return false'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7r0Ju8Cn4vU7JZ331trrD8g7PDq_sMo-MOB5gtPquWLNv1svDrHSHewuKeweQ-yd5Asl9L_PccmSSJAUgDHmC9zErmPMnq4OoLbmDuqgXVLlxlHI4wpEF1KPfZUET9ZB3CtpsJ7K2unaT/s1600/centro.png' style='position:fixed; bottom:45px; right:10px;' title='Ir centro'/></a>

<a href='#footer-wrapper' onclick='new Effect.ScrollTo("footer-wrapper",{offset:-150}); return false'><img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrXvLIPRj5zElLdDV9GwO9EkHd-wS49siz0Hv6jWGFvu5EqfMzeh8jRvx0bipuIYIQl2yscVfqdBJGBeOMcKwlsRCANMNt3Qa5FPsIB2ah8clvsdzQII2agtPAF3G9jFDx5cWQFWRR10wy/s1600/abajo.png' style='position:fixed; bottom:10px; right:10px;' title='Ir abajo'/></a>
<!-- fin ir arriba,centro y abajo -->

Guardar cambios.


Consejo: No utilizar Jquery y Scriptaculous juntos, para evitar conflictos.

Leer más..., Seguir leyendo... (4)

Si no lo tenemos colocamos el código antes de </head>:

<script type='text/javascript' src='http://www.google.com/jsapi'></script>

<script type='text/javascript'>

google.load("prototype","1.6.0.3");

google.load("scriptaculous", "1.8.2");

</script>



Cambiar Boton1 por 2, 3, 4, etc...




O dejarle el mismo numero para Abrir y Cerrar








Código con botón abrir y botón cerrar: (ejemplo Abrir 2)
<input onclick="Effect.toggle('Boton1','slide'); return false" value="Abrir 2" type="button" />
<div id="Boton1" style="overflow: visible; display: none; text-align: left;">CONTENIDO CON LO QUE QUIERAS OCULTAR<input onclick="Effect.toggle('Boton1','slide'); return false" value="Cerrar" type="button" /><div id="Boton1" style="overflow: visible; display: none; text-align: left;"></div></div>
Boton1: es el nombre unico que hay que cambiar cada ves que se crea un botón.(tiene que ser distinto en cada botón)
value="Abrir 2": dentro de vaule es el texto que muestra el botón.