Bonjour,
Après un coup d'oeil plus approfondi sur le forum de symfony, j'ai
effectivement trouvé comment résoudre mon problème.
En fait il faut faire un rappel de la fonction initLightbox dans le
template chargé par l'appel ajax.
Cependant cette solution présentant un gros problème (duplication de
l'intégralité du code HTML correspondant à l'aperçu à chaque appel
ajax), j'ai apporté une ou deux petites modifs au code javascript du
fichier lightbox.js.

Si cela interresse quelqu'un, voici mes modifs :

Ajout de la méthode reinitialize à la classe lightbox :

        reinitialize: function() {
                if (!document.getElementsByTagName){ return; }
                var anchors = document.getElementsByTagName('a');

                // loop through all anchor tags
                for (var i=0; i<anchors.length; i++){
                        var anchor = anchors[i];

                        var relAttribute = String(anchor.getAttribute('rel'));

                        // use the string.match() method to catch 'lightbox' 
references in
the rel attribute
                        if (anchor.getAttribute('href') &&
(relAttribute.toLowerCase().match('lightbox'))){
                                anchor.onclick = function () 
{myLightbox.start(this); return
false;}
                        }
                }
        },

Ajout de la fonction reInitLightBox en bas du fichier lightbox.js :

        reinitialize: function() {
                if (!document.getElementsByTagName){ return; }
                var anchors = document.getElementsByTagName('a');

                // loop through all anchor tags
                for (var i=0; i<anchors.length; i++){
                        var anchor = anchors[i];

                        var relAttribute = String(anchor.getAttribute('rel'));

                        // use the string.match() method to catch 'lightbox' 
references in
the rel attribute
                        if (anchor.getAttribute('href') &&
(relAttribute.toLowerCase().match('lightbox'))){
                                anchor.onclick = function () 
{myLightbox.start(this); return
false;}
                        }
                }
        },

Ainsi le code suivant n'est pas dupliqué :

                <div id="overlay"></div>
                <div id="lightbox">
                        <div id="outerImageContainer">
                                <div id="imageContainer">
                                        <img id="lightboxImage">
                                        <div style="" id="hoverNav">
                                                <a href="#" id="prevLink"></a>
                                                <a href="#" id="nextLink"></a>
                                        </div>
                                        <div id="loading">
                                                <a href="#" id="loadingLink">
                                                        <img 
src="/images/lightbox/loading.gif">
                                                </a>
                                        </div>
                                </div>
                        </div>
                        <div id="imageDataContainer">
                                <div id="imageData">
                                        <div id="imageDetails">
                                                <span id="caption"></span>
                                                <span id="numberDisplay"></span>
                                        </div>
                                        <div id="bottomNav">
                                                <a href="#" id="bottomNavClose">
                                                        <img 
src="/images/lightbox/close.gif">
                                                </a>
                                        </div>
                                </div>
                        </div>
                </div>


Merci pour l'indication...

Olivier


--~--~---------~--~----~------------~-------~--~----~
Vous avez reçu ce message, car vous êtes abonné au groupe Groupe "Symfony-fr" 
de Google Groupes.
 Pour transmettre des messages à ce groupe, envoyez un e-mail à 
l'adresse [email protected]
 Pour résilier votre abonnement à ce groupe, envoyez un e-mail à 
l'adresse [EMAIL PROTECTED]
 Pour afficher d'autres options, visitez ce groupe à l'adresse 
http://groups.google.com/group/symfony-fr?hl=fr
-~----------~----~----~----~------~----~------~--~---

Répondre à