您的位置:首页 > Web前端 > BootStrap

PHPOK 调用bootstrap 自适应轮播图的方法。

2015-02-04 10:14 393 查看
首页网页中要引入bootstrap 的文件

<link rel="stylesheet" type="text/css" href="images/bootstrap.min.css" />

<script src="images/jquery.1.9.1.min.js"></script>

//然后轮播放图部分

<style type="text/css">

/***轮播图***/

.carousel-control.right { background-image: none; }

.carousel-control.left { background-image: none; }

.bs-example .btnr{width:46px; height:100%; background:url(btnlr.png) no-repeat right center;}

.bs-example .btnl{width:46px; height:100%; background:url(btnlr.png) no-repeat left center;}

.carousel-indicators li{width:11px; height:11px; background:url(01.png) no-repeat left; margin:0 10px; border:0px; }

.carousel-indicators li.active{background:url(01.png) no-repeat right; margin:0 10px;width:11px; height:11px;}

</style>

<div class="bs-example">

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

      <ol class="carousel-indicators">     

       <!-- run:$tags = phpok_c_list("shouyehuandengpian",99) -->

      <!-- $tags[rslist] AS $key=>$v -->

       <li data-target="#myCarousel" data-slide-to=""></li>

       <!-- end -->

     <!-- run:unset($tags) -->

   </ol>   

    <div class="carousel-inner" role="listbox">

     <!-- run:$tags = phpok_c_list("shouyehuandengpian",99) -->

      <!-- $tags[rslist] AS $key=>$v -->

      <div class="item"><img data-holder-rendered="true" src="{:$v[picture]}"> </div>

     <!-- end -->

     <!-- run:unset($tags) -->

    </div>

    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="prev">

    <span class="glyphicon btnr"></span> 

    </a> 

    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="next"> 

    <span class="glyphicon btnl"></span> 

    </a> 

   </div>

</div>

<script type="text/javascript">

$(".carousel-indicators li:first").addClass("active");

$(".carousel-inner div:first").addClass("active");

<!-- run:$tags = phpok_c_list("shouyehuandengpian",99) -->

<!-- $tags[rslist] AS $key=>$v -->

$(".carousel-indicators li").each(function(index, element) {

    $(this).attr("data-slide-to",$(this).index());

});

<!-- end -->

<!-- run:unset($tags) -->

</script>     

   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: