在我的MVC项目中包含owl Carousel和funcybox

时间:2015-09-28 17:49:13

标签: jquery asp.net-mvc

如何在我的MVC项目中加入owl Carousel和funcybox?

我从Nuget下载owl Carousel,在我的common.js中我有:

$(document).ready(function () {
var owl = $(".carousel");
    owl.owlCarousel({
        items: 2,
        autoHeight: true
    });
});

在我的BundleConfig中,我有:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js",
                        "~/Scripts/owl.carousel.js",
                        "~/Scripts/jquery-2.1.4.min.js"));

在我的HTML中:

@Scripts.Render("~/bundles/jquery")
    <div class="carousel">
                            <div class="slide_item"><img src="http://i.imgur.com/iv6qWgb.jpg"/>
                            </div>
                            <div class="slide_item"><img src="http://images2.fanpop.com/images/photos/6900000/Andy-Murray-wallpapers-3-tennis-6904485-1024-768.jpg"/>
                            </div>
                        </div>

但是Carousel没有用。为什么呢?

1 个答案:

答案 0 :(得分:0)

您是否尝试将CS​​S文件添加到捆绑包中? 例如:

bundles.Add(new StyleBundle("~/Content/css").Include(
    "~/Content/OwlCarousel/owl.carousel.css",
    "~/Content/OwlCarousel/owl.theme.css",
    "~/Content/OwlCarousel/owl.transitions.css",
    "~/Content/bootstrap.css",
    "~/Content/site.css"));