Hola. Im tratando de construir una galería de miniaturas que, cuando se hace clic, crecer para mostrar la imagen en tamaño completo. He creado un conjunto de datos XML de Spry e Im con un ágil: repetir que pasar por cada fila del conjunto de datos y crear la miniatura. A continuación le adjunto el efecto de crecer, pero ya que el objetivo es cada una de las miniaturas, necesito un identificador único para cada uno. Intenté usar id = "thumb_ () ds_RowID" (y ds_RowCount y ds_RowNumber), pero no funciona.
Heres mi código. XML de muestra:
<thumbnail_list>
<thumbnail>
<path>images/1.jpg</path>
<caption>some text</caption>
</thumbnail>
...
<thumbnail>
<path>images/n.jpg</path>
<caption>some text</caption>
</thumbnail>
</thumbnail_list>
-
- <thumbnail_list>
- <thumbnail>
- <path>images/1.jpg</path>
- <caption>some text</caption>
- </thumbnail>
- ...
- <thumbnail>
- <path>images/n.jpg</path>
- <caption>some text</caption>
- </thumbnail>
- </thumbnail_list>
-
En la página HTML Luego de crear el conjunto de datos y la galería.
dataset:
var dsThumbs = new Spry.Data.NestedXMLDataSet(dsThumbs, "thumbnail_list/thumbail");
gallery:
<table>
<tr spry:region="dsThumbnails" spry:repeat="dsThumbnails">
<td><img id="wp_{ds_RowID}" src="{path}" onclick="grow_effect_{ds_RowID}.start(); return false;"/></td>
</tr>
</table>
-
- dataset:
- var dsThumbs = new Spry.Data.NestedXMLDataSet(dsThumbs, "thumbnail_list/thumbail");
-
- gallery:
- <table>
- <tr spry:region="dsThumbnails" spry:repeat="dsThumbnails">
- <td><img id="wp_{ds_RowID}" src="{path}" onclick="grow_effect_{ds_RowID}.start(); return false;"/></td>
- </tr>
- </table>
-
Entonces tengo que crear la variable que representa el efecto de crecer. Traté de 2 diferentes enfoques:
1. Inside the spry:region, in the spry:repeat loop:
<table>
<tr spry:region="dsThumbnails" spry:repeat="dsThumbnails">
<td><img id="wp_{ds_RowID}" src="{path}" onclick="grow_effect_{ds_RowID}.start(); return false;"/></td>
<script type="text/javascript">
var grow_effect_{ds_RowID} = new Spry.Effect.Grow("wp_{ds_RowID}", {duration:1000, from:"100%", to:"20%", toggle: true});
</script>
</tr>
</table>
2. And at the end of the code, creating each variable manually:
<script type="text/javascript">
var grow_effect_0 = new Spry.Effect.Grow("wp_0", {duration:1000, from:"100%", to:"20%", toggle: true});
...
var grow_effect_n = new Spry.Effect.Grow("wp_n", {duration:1000, from:"100%", to:"20%", toggle: true});
</script>
-
- 1. Inside the spry:region, in the spry:repeat loop:
- <table>
- <tr spry:region="dsThumbnails" spry:repeat="dsThumbnails">
- <td><img id="wp_{ds_RowID}" src="{path}" onclick="grow_effect_{ds_RowID}.start(); return false;"/></td>
- <script type="text/javascript">
- var grow_effect_{ds_RowID} = new Spry.Effect.Grow("wp_{ds_RowID}", {duration:1000, from:"100%", to:"20%", toggle: true});
- </script>
- </tr>
- </table>
-
- 2. And at the end of the code, creating each variable manually:
- <script type="text/javascript">
- var grow_effect_0 = new Spry.Effect.Grow("wp_0", {duration:1000, from:"100%", to:"20%", toggle: true});
- ...
- var grow_effect_n = new Spry.Effect.Grow("wp_n", {duration:1000, from:"100%", to:"20%", toggle: true});
- </script>
-
Ninguno de estos trabajado, y creo que entender por qué en el 1er enfoque. El ds_RowID no es válido fuera de la Spry: región, pero tal vez theres una manera de evitar esto?
¿Puede alguien darme algún tipo de asesoramiento sobre cómo podría hacer este trabajo? Gracias.