简体   繁体   English

如何在PHP中使用bootstrap垂直选项卡通过click事件将动态内容显示到div中

[英]How to show dynamic content into a div using bootstrap vertical tab by click event in PHP

Basically i show static content a into div using Bootstrap vertical tab. 基本上,我使用Bootstrap垂直标签将静态内容显示到div中。 Something like that. 这样的事情。

Html: http://ezytheme.com/test/verticaltimeline/index.html HTML: http//ezytheme.com/test/verticaltimeline/index.html

But problem is that i can't show dynamic content into a div using bootstrap vertical tab by click event in PHP 但是问题是我无法使用PHP中的单击事件通过bootstrap垂直选项卡将动态内容显示到div中

I'm trying to solve but can't get any proper guide. 我正在尝试解决,但没有任何适当的指导。 Anybody tell me a way to solve this problem. 有人告诉我解决这个问题的方法。

Bellow my code: 下面是我的代码:

index.php 的index.php

<?php
   include("vars.php");
?> 

<div class="lan_vertical_timeline">
    <ul class="nav nav-tabs" role="tablist" id="myTab">
        <?php $j=3; ?>
        <?php for($i=1; $i<=$j; $i++)
                { ?>
                    <li role="presentation" class="active">
                        <a href="#home" aria-controls="home" role="tab" data-toggle="tab">
                            <ul class="cbp_tmtimeline">
                                <li>
                                    <div class="cbp_tmicon"></div>
                                    <div class="cbp_tmlabel">
                                        <h3>CHIILDREN IN CARE</h3>
                                        <p>Ad munere detraxit.</p>
                                    </div>
                                </li>
                            </ul>                           
                        </a>
                    </li>
            <?php } ?>          
    </ul>

    <?php
        $i = 0;
        foreach($blog_item as $newItem) {
        ?>
            <div class="back-thumbnail">
                    <div class="blog-content">
                        <h2><?php echo $newItem['name']; ?></h2>
                        <?php echo $newItem['description']; ?>                                
                    </div>
                </div>
            </div>
        <?php
            $i++;
        }
        ?>
</div>


   <script>
        $('#myTab a').click(function (e) {
          e.preventDefault()
          $(this).tab('show');
          $( ".tab-pane" ).addClass( "animated fadeInRight" );
        });
    </script>

vars.php vars.php

<?php

$blog_item = array(
array(
    "name" => "Item One",
    "description" => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>",
),
array(
    "name" => "Item Two",
    "description" => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
),
array(
    "name" => "Item Three",
    "description" => "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
)    
);

Please see this link: http://ezytheme.com/test/php/verticaltimeline/ 请查看此链接: http : //ezytheme.com/test/php/verticaltimeline/

How do I achieve something like that? 我该如何实现? http://ezytheme.com/test/verticaltimeline/index.html http://ezytheme.com/test/verticaltimeline/index.html

jsfiddle: http://jsfiddle.net/bretlee45/btt07zsj/1/ jsfiddle: http : //jsfiddle.net/bretlee45/btt07zsj/1/

您可以使用JQuery Ajax Api文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM