Búsqueda personalizada

Prototype Carousel Class

Prototype Carousel Class, Una excelente galería carrusel basada en la de Bill Scott’s Carousel component., esta vez utilizando Prototype/script.aculo.us.

Esta versión (0.26) incluye:

  • Actualizacion con script.aculo.us
  • ScrollTo (0,25) (gracias a Stéphane Brun)
  • Ajax manejador ( “antes”, “después”)
  • Animación ( “antes”, “después”)
  • Ajax o contenido estático
  • Orientación horizontal
  • Y más … :)

Lo archivos que necesitamos descargar para crearla

  • carousel.js
  • carousel.css
  • effects.js
  • prototype.js
  • application.css

Descargar

En nuestro encabezado hacemos la llamada a los archivos correspondientes

JavaScript:

  1. <script src=“js/prototype.js” type=“text/javascript”></script>
  2. <script src=“js/effects.js” type=“text/javascript”></script>
  3. <script src=“js/carousel.js” type=“text/javascript”></script>
  4. <link href=“css/carousel.css” media=“all” rel=“Stylesheet” type=“text/css”>
  5. <link href=“css/application.css” media=“all” rel=“Stylesheet” type=“text/css”>

A continuación el código HTML, JS y también la inhabilitación de los botones de las funciones de animación y el CSS, para este carrusel

HTML:

  1. <div id=“prev-arrow-container”>
  2. <img id=“prev-arrow-small” class=“left-button-image” src=“/images/left-enabled.gif”/>
  3. </div>
  4. <div class=“carousel-component” id=“small-carousel”>
  5. <div class=“carousel-clip-region”>
  6. <ul class=“carousel-list”>
  7. <li><img alt=“Image1″ src=“/images/small_icons/image1.png” /></li>
  8. <li><img alt=“Image2″ src=“/images/small_icons/image2.png” /></li>
  9. <li><img alt=“Image1″ src=“/images/small_icons/image3.png” /></li>
  10. <li><img alt=“Image2″ src=“/images/small_icons/image4.png” /></li>
  11. <li><img alt=“Image1″ src=“/images/small_icons/image5.png” /></li>
  12. <li><img alt=“Image2″ src=“/images/small_icons/image6.png” /></li>
  13. …etc etc
  14. </ul>
  15. </div>
  16. </div>
  17. <div id=“next-arrow-container”>
  18. <img id=“next-arrow-small” class=“right-button-image” src=“/images/right-enabled.gif”/>
  19. </div>
  20. <script type=“text/javascript”>
  21. Event.observe(window, “load”, initCarousel);
  22. function initCarousel() {
  23. var carousel = new Carousel(“ajax-carousel”,  {url: “/update”, buttonStateHandler: buttonStateHandler, animParameters: {duration: 0.5}});
  24. }
  25. </script>

En caso de que deseemos hacer uso de otras funciones (esto es opcional), Javascript para habilitar o deshabilitar los botones de transición.

JavaScript:

  1. function buttonStateHandler(button, enabled) {
  2. if (button == “prev-arrow”)
  3. $(‘prev-arrow’).src = enabled ? “images/left3-enabled.gif” : “images/left3-disabled.gif”
  4. else
  5. $(‘next-arrow’).src = enabled ? “images/right3-enabled.gif” : “images/right3-disabled.gif”
  6. }
  7. function animHandler(carouselID, status, direction) {
  8. var region = $(carouselID).down(“.carousel-clip-region”)
  9. if (status == “before”) {
  10. Effect.Fade(region, {to: 0.3, queue: { position:‘end’, scope: “carousel” }, duration: 0.2})
  11. }
  12. if (status == “after”) {
  13. Effect.Fade(region, {to: 1, queue: { position:‘end’, scope: “carousel” }, duration: 0.2})
  14. }
  15. }

Esto es sólo una porcion de las opciones predeterminadas en carousel.css, y el cual podremos modificar a nuestro antojo.

CSS:

  1. #html-carousel .carousel-list li {
  2. width: 106px;
  3. border: 0px solid green;
  4. padding: 10px;
  5. padding-top:  15px;
  6. margin: 0;
  7. color: #3F3F3F;
  8. }
  9. #html-carousel .carousel-list li img {
  10. border:1px solid #999;
  11. display:block;
  12. }
  13. #html-carousel {
  14. margin-bottom: 10px;
  15. float: left;
  16. width: 500px;
  17. height: 144px;
  18. }
  19. /* BUTTONS */
  20. #prev-arrow-container, #next-arrow-container {
  21. float:left;
  22. margin: 0px;
  23. padding: 0px;
  24. }
  25. #next-arrow {
  26. cursor:pointer;
  27. }
  28. #prev-arrow {
  29. cursor:pointer;
  30. }
  31. /* Overlay */
  32. #overlay {
  33. width: 200px;
  34. height: 80px;
  35. background-color:  #FFF;
  36. position: absolute;
  37. top: 25px;
  38. left: 150px;
  39. padding-top: 10px;
  40. z-index: 100;
  41. color: #000;
  42. border:1px dotted #000;
  43. text-align: center;
  44. font-size: 24px;
  45. filter:alpha(opacity=80);
  46. -moz-opacity: 0.8;
  47. opacity: 0.8;
  48. }
Publicado en Galerías,Javascript,scripts | 2 Comments

JavaScript para agregar notas en imágenes online al estilo Flickr

1884179144_decc290d10_o.jpg

Photo Notes es una librería JavaScript que nos permite agregar pequeñas notas a nuestras imágenes al estilo Flickr, pero lo mejor es que nos permite visualizar en tiempo real, actualizar, y manipular nuestras notas online.

Ver  – Descarga Completa Version Oficial – Ver demo oficial

PLAIN TEXT

HTML:
  1. <script src=“foot/PhotoNotes.js” type=“text/javascript”></script>
  2. </p>
  3. <link href=“foot/PhotoNotes.css” rel=“stylesheet” type=“text/css”>

Estructura

Boton agregar texto

HTML:
  1. <input name=“button” type=“button” style=“margin-left: 30px;” onClick=“AddNote();” value=“agregar texto” />

Nuestra imagen y nuestro script

HTML:
  1. <div class=“Photo fn-container” id=“PhotoContainer”>
  2. <img src=“foot/0.jpg” width=“300″ height=“243″ galleryimg=“no”>
  3. /* create the Photo Note Container */
  4. var notes = new PhotoNoteContainer(document.getElementById(‘PhotoContainer’));
  5. /* create a couple of notes, and add them to the container */
  6. var note1 = new PhotoNote(‘boca’,3,new PhotoNoteRect( 180,113,60,60));
  7. note1.onsave = function (note) { return 1; };
  8. note1.ondelete = function (note) { return true; };
  9. var note2 = new PhotoNote(‘nariz’,3,new PhotoNoteRect(259,111,15,15));
  10. note2.onsave = function (note) { return 1; };
  11. note2.ondelete = function (note) { return true; };
  12. notes.AddNote(note1);
  13. notes.AddNote(note2);
  14. function AddNote()
  15. {
  16. var newNote = new PhotoNote(‘Agrega tu texto y acomodalo en una seccion.’,-1,new PhotoNoteRect(10,10,50,50));
  17. newNote.onsave = function (note) { return 1; };
  18. newNote.ondelete = function (note) { return true; };
  19. notes.AddNote(newNote);
  20. newNote.Select();
  21. }
  22. </script>
  23. </div>
Publicado en Fotografía,Javascript,scripts | Responder

Javascript para dar reflejos 3D a nuestras imágenes

reflecxion.jpg

3d image reflection un discreto Javascript que mediante prototype + script.aculo.us nos permitirá dar reflejos a nuestras imágenes y evitar con esto tener que perder tiempo editándolas de forma individual. Su utilización es realmente muy sencilla y lso resultados realmente agradables. Probado en Firefox, Opera e IE. Preloading en imágenes antes de la reflexión.

DemoDescarga

Uso:

en nuestro encabezado dentro de las etiquetas < Head > incluir prototype, script.aculo.us y el script reflexión

JavaScript:

  1. <script src=“javascript/prototype.js” type=“text/javascript”></script>
  2. <script src=“javascript/scriptaculous.js?load=builder” type=“text/javascript”></script>
  3. <script src=“javascript/reflection.js” type=“text/javascript”></script>

contenido

HTML:

  1. <p id = “holder”>
  2. <img src = “imagen.jpg” />
  3. </p>
  4. <script type=“text/javascript”>
  5. new Reflect3D(‘holder’);
  6. </script>
Publicado en Javascript,scripts | Responder

Novedades