Javascript 引导映像模式弹出jquery php

Javascript 引导映像模式弹出jquery php,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我正在构建一个模式,以显示我的图像旋转木马。但它不工作-弹出窗口出来,但没有图像。我需要帮助来看看我的代码有什么问题。它根本没有显示任何图像,即使我不知道是什么原因造成的。我想实现的是,弹出图像,点击产品菜单 图像位于一个将调用模态的视图中: <div id="carousel" class="carousel slide" data-ride="carousel"> <div class="carousel-inner"> <?php $bany

我正在构建一个模式,以显示我的图像旋转木马。但它不工作-弹出窗口出来,但没有图像。我需要帮助来看看我的代码有什么问题。它根本没有显示任何图像,即使我不知道是什么原因造成的。我想实现的是,弹出图像,点击产品菜单

图像位于一个将调用模态的视图中:

<div id="carousel" class="carousel slide" data-ride="carousel">

  <div class="carousel-inner">

    <?php 
$banyak = 0;
$id = $results->id;
$barangNama = $results->nama;
$barangHarga1 = $results->harga;
$barangGambar = $results->gambar;
$barangMerk = $results->merk;
$barangCategory = $results->category;
$barangTipe = $results->tipe;
$barangDeskripsi = $results->deskripsi;

$barangHarga = number_format($barangHarga1);

$newGambar = explode(',',$barangGambar);
//print_r($newGambar);
?>

    <?php 
$w = 0;
for($i = 0; $i < count($newGambar); $i++) {


if($w % 4 == 0){
$banyak++;
}
$w++;
//echo $banyak;
?>
    <div class="item <?php if($i == 0){echo "active";} ?>" data-thumb="<?php echo $banyak-1; ?>">
      /* this is where i call the modal */  <a href="#" data-toggle="modal" data-target="#image-gallery">
      <img src="<?php echo base_url(); ?>assets/images/product_picture/<?php echo $newGambar[$i]; ?>" alt="asda">
      </a>    
    </div>
    <?php   
}
?>
    <a class="left carousel-control" href="#carousel" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
    </a>
    <a class="right carousel-control" href="#carousel" role="button" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
    </a>
  </div>
</div>

我猜您已经注释掉了输出

<?php 
  $w = 0;
  for ($i = 0; $i < count($newGambar); $i++) {
    if ($w % 4 == 0){
    $banyak++;
  }
  $w++;
  echo $banyak;
?>

这是因为z-index值。请检查网页。检查旋转木马的z-index。大多数开发人员在代码中输入了-9999px和9999px值或类似值

调整z索引值,使模态框及其容器位于旋转木马的顶部

bootstrap模式css在bootstrap.css中

$(document).ready(function(){

  loadGallery(true, 'a.thumbnail');

  //This function disables buttons when needed
  function disableButtons(counter_max, counter_current){
    $('#show-previous-image, #show-next-image').show();
    if(counter_max == counter_current){
      $('#show-next-image').hide();
    } else if (counter_current == 1){
      $('#show-previous-image').hide();
    }
  }
  function loadGallery(setIDs, setClickAttr){
    var current_image,
        selector,
        counter = 0;

    $('#show-next-image, #show-previous-image').click(function(){
      if($(this).attr('id') == 'show-previous-image'){
        current_image--;
      } else {
        current_image++;
      }

      selector = $('[data-image-id="' + current_image + '"]');
      updateGallery(selector);
    });

    function updateGallery(selector) {
      var $sel = selector;
      current_image = $sel.data('image-id');
      $('#image-gallery-caption').text($sel.data('caption'));
      $('#image-gallery-title').text($sel.data('title'));
      $('#image-gallery-image').attr('src', $sel.data('image'));
      disableButtons(counter, $sel.data('image-id'));
    }

    if(setIDs == true){
      $('[data-image-id]').each(function(){
        counter++;
        $(this).attr('data-image-id',counter);
      });
    }
    $(setClickAttr).on('click',function(){
      updateGallery($(this));
    });
  }
});
<?php 
  $w = 0;
  for ($i = 0; $i < count($newGambar); $i++) {
    if ($w % 4 == 0){
    $banyak++;
  }
  $w++;
  echo $banyak;
?>