Probleme zoombox et XML

Par pivot85150, il y a 15 ans


Bonjour,

j'ai un problème avec Zoombox et ajax et jquery..
Je ne comprend pas pourquoi mon image Zoombox créer par Ajax ne marche pas avec zoombox..

Voici mes codes :
Voici xml.js :

$(function(){
    $.ajax({
        type: "GET",
        url: "site.xml",
        dataType: "xml",
        succes: function(xml){
            $(xml).find('video').each(function(){
                var id = $(this).attr('id');
                var titre = $("this").find('titre').text();
                var url_image = $("this").find('image').text();
                var url_video = $("this").find('video_url').text();
                $('<div class="video" id="link_' + id + '"></div>').html('<a href="images/' + url_video + '" rel="zoombox" title="test"><img src="images/' + url_image + '" alt="test" /></a>').appendTo('#Div_XML');
            });
        }
    });
});

Voici site.xml :

<sites>
    <video id="4">
        <titre>bjr</titre>
        <image>menu1.jpg</image>
        <video_url>menu2.jpg</video_url>
    </video>
</sites>

et voici mon html (HEAD) :

<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/xml.js"></script>
<script type="text/javascript" src="Zoombox/zoombox.js"></script>
<link href="Zoombox/zoombox.css" rel="stylesheet" type="text/css" media="screen" />
</head>

Voici mon BODY :

<div id="Div_XML"></div>

Je tient a precisé que avec un lien normalement ecrit et non generer par XML zoombox marche..

8 réponses

pivot85150, il y a 15 ans

Up s'il vous plait j'en ai vraiment besoin... :D
merci a ceux qui repondront

PhiSyX, il y a 14 ans

Met $(this) au lieux de $("this")
Il manque un s à succes:

pivot85150, il y a 14 ans

J'ai reussi mais je en sais pas comment faire pour que chaque image s'ouvre avec zoombox..

PhiSyX, il y a 14 ans

Hello,
Si tu as la dernière version, il faut ajouter dans ton code javascript certaines conditions : http://www.grafikart.fr/zoombox/howto
Si tu as l'ancienne version, normalement un lien avec l'attribut rel="zoombox" suffira.
Voilà :p

pivot85150, il y a 14 ans

J'ai enfin reussi, j'ai utiliser $.zoombox.open(title) mais le probleme est que je voudrais faire une galerie, savez vous comment avec cette methode ?..
Merci beaucoup :D

PhiSyX, il y a 14 ans

Oui, rajoute dans ton lien ceci class="taclass zgallery1"
Puis après le success:fnc.. ajouter ceci:

complete:function(){
    $("a.taclass").zoombox();
}

Voilà :p

pivot85150, il y a 14 ans

Oui mais non car zoombox est appelé en public

PhiSyX, il y a 14 ans

Mmmh? Je ne comprends pas...