"#下一页"和" #Prev"在mvc项目中不起作用的小型旋转木马的功能

时间:2015-04-22 07:51:39

标签: jquery css asp.net-mvc twitter-bootstrap carousel

我必须在我的项目中使用简单的内容轮播。使用jquery 2.1.3 ...... 在此之前我使用了jquery内容轮播,但它没有响应,所以我一直在寻找简单的响应式轮播,并找到:Tiny Carousel

现在我把它的.js和.css文件放在Bundles.config中可以看出:

bundles.Add(new ScriptBundle("~/bundles/euro/js").
Include("~/Scripts/euro/*.js", "~/Scripts/euro/jquery.tinycarousel.js"));
bundles.Add(new StyleBundle("~/Content/euro/css").
Include("~/Content/euro/*.css", "~/Content/euro/tinycarousel.css"));

并在视图中

 <div id="slider1">
        <a class="buttons prev" href="#">&#60;</a>
        <div class="viewport">
            <ul class="overview">
                <li><img src="~/images/contact.png" /></li>
                <li><img src="~/images/contact.png" /></li>
                <li><img src="~/images/contact.png" /></li>
                <li><img src="~/images/contact.png" /></li>
            </ul>
        </div>
        <a class="buttons next" href="#">&#62;</a>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#slider1').tinycarousel();
        });
    </script>

图片: enter image description here

问题是“上一页”和“下一页”控件不起作用,而且还没有显示完整图像

可能是旧的/新的jquery问题......请有人帮忙...     或者我可以检查firebug中的脚本或css文件问题吗?

感谢您的时间..

1 个答案:

答案 0 :(得分:1)

您可以使用bootstrap carousel对现有的bootstrap模板进行位修改。 Bootstrap移动每个.item元素,因此只需在每个.item内放置多个图像,这将为您提供几乎所需的结果。

<强> DEMO

<div class="container-fluid">
<div class="row-fluid">
<div class="span12">

    <div class="page-header">
        <h3>Bootstrap</h3>
        <p>Responsive Moving Box Carousel Demo</p>
    </div>

    <div class="carousel slide" id="myCarousel">
        <div class="carousel-inner">
            <div class="item active">
                    <ul class="thumbnails">
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                    </ul>
              </div><!-- /Slide1 --> 
            <div class="item">
                    <ul class="thumbnails">
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                    </ul>
              </div><!-- /Slide2 --> 
            <div class="item">
                    <ul class="thumbnails">
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                        <li class="span3">
                            <div class="thumbnail">
                                <a href="#"><img src="http://placehold.it/360x240" alt=""></a>
                            </div>

                        </li>
                    </ul>
              </div><!-- /Slide3 --> 
        </div>

        <div class="control-box">                            
            <a data-slide="prev" href="#myCarousel" class="carousel-control left">‹</a>
            <a data-slide="next" href="#myCarousel" class="carousel-control right">›</a>
        </div><!-- /.control-box -->   

    </div><!-- /#myCarousel -->

</div><!-- /.span12 -->          
</div><!-- /.row --> 
</div><!-- /.container -->