Jquery Jcarousel不使用PHP

时间:2015-05-06 16:51:00

标签: php jquery jcarousel

我有这段代码:

<div class="modal hide" style="display:none" id='mostrarImagenes'>
    <div class="modal-header" style="background-color:#009975">
        <button type="button" class="close" data-dismiss="modal">x</button>
        <br/>
    </div>
    <div class="modal-body" style="background:#9FD5D1;">

        <p id="galeriaImagenes">
            <a href="../imagenes/img1.jpg" target="_self" class="inline-block litebox" data-litebox-group="group-1"><img src="../imagenes/img1.jpg" class="inline-block" width="100" height="100"/></a>
            <a href="../imagenes/img2.jpg" target="_self" class="inline-block litebox" data-litebox-group="group-1"><img src="../imagenes/img2.jpg" class="inline-block" width="100" height="100"/></a>
            <a href="../imagenes/img3.jpg" target="_self" class="inline-block litebox" data-litebox-group="group-1"><img src="../imagenes/img3.jpg" class="inline-block" width="100" height="100"/></a>
            <a href="../imagenes/img4.jpg" target="_self" class="inline-block litebox" data-litebox-group="group-1"><img src="../imagenes/img4.jpg" class="inline-block" width="100" height="100"/></a>
            <a href="../imagenes/img5.jpg" target="_self" class="inline-block litebox" data-litebox-group="group-1"><img src="../imagenes/img5.jpg" class="inline-block" width="100" height="100"/></a>
            <a href="../imagenes/img6.png" target="_self" class="inline-block litebox" data-litebox-group="group-1"><img src="../imagenes/img6.png" class="inline-block" width="100" height="100"/></a>
        </p>

    </div>
</div>

哪个在HTML文档中。当我点击任何图像时,Jcarousel会正确显示,如下所示:

enter image description here

问题是这个图库需要从数据库填充,我已用此代码实现了这一点:

<?php
    include("FuncionesBaseDatos.php");
    $bd = new FuncionesBaseDatos();

    $idVisita = $_POST['t1'];

    $queryImagenes = pg_query("
        SELECT
            ID_IMAGEN,
            NOMBRE,
            RUTA
        FROM IMAGEN
        WHERE ID_VISITA = $idVisita
    ");

    while($imagen = pg_fetch_row($queryImagenes)){
        $aux = str_replace('\\', '/',$imagen[2]) . '/' . $imagen[1];
        echo "
            <a id='$imagen[0]' href='$aux' target='_self' class='inline-block litebox' data-litebox-group='group-1'>
                <img src='$aux' class='inline-block' width='100' height='100' alt='$imagen[1]'/>
            </a>
        ";
    }
?>

但是,尽管如此,当我点击这些新图像时,Jcarousel并没有显示,而是由浏览器打开图像,如下所示:

enter image description here

我不知道为什么会发生这种情况。

任何想法都将非常感激。 谢谢!

0 个答案:

没有答案