Bootstrap Carousel不在药丸内容中工作

时间:2017-09-04 03:44:41

标签: jquery css twitter-bootstrap

我的转盘代码在file2.php。它工作正常。 但是当我尝试将其加载到file1(div myhome)的标签内容时,轮播只是保持静态。我尝试在CSS文件的tab-content中添加'display:block',但它没有用

file1.php:

<ul id="mainpill" class="nav nav-pills nav-justified">
  <li id="tab0">
    <a data-toggle="pill" href="#home">
      <span class="glyphicon glyphicon-home"></span>
    </a>
  </li>
</ul>
<div class="tab-content">
  <div id="home" class="tab-pane fade in active">
    <div id="myhome"></div>
  </div>
</div>

file2.php:

carousel code

file3.js:

$('#tab0').click(function() {
  $('#myhome').load('file2.php');
});

1 个答案:

答案 0 :(得分:0)

请更改您的file1.php和file3.js代码:

file1.php

    <ul id="mainpill" class="nav nav-pills nav-justified">
      <li id="tab0">      
        <a href ="#" onclick="load_home()"> 
            <span class="glyphicon glyphicon-home"></span> 
        </a>  

      </li>
    </ul>
    <div class="tab-content">
      <div id="home" class="tab-pane fade in active">
        <div id="myhome"></div>
      </div>
    </div>

**file3.js**


 function load_home() {
     document.getElementById("myhome").innerHTML='<object type="text/html" data="File2.php" ></object>';
}