如何在Umbraco 7中实现bootstrap Carousel

时间:2017-08-31 08:39:58

标签: jquery css asp.net-mvc bootstrap-4 umbraco7

我是Umbraco的新手7.刚刚获得了与Umbraco一起创建我的第一个.Net MVC网站的分配。

我创建了一个引导程序Carousel - Only Im无法在Media Picker中获取图像并将它们插入到轮播中。

我在下面列出我的代码 - 请帮助我,谢谢

[文档类型 - HomeBase]

  1. 姓名:Carousel Gallery

  2. Alias:carouselGallery

  3. 数据类型:媒体选择器

  4. 这是将托管Carosel [HomeBase.cshtml]

    的页面
    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.HomeBase>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "Master.cshtml";
    }
    
    <div class="wrapper">
    
        <div id="mycarousel" class="carousel slide" data-ride="carousel">
    
            <!-- Wrapper for slides -->
            <div class="carousel-inner" role="listbox">
    
                @Umbraco.RenderMacro("GalleryImages")
    
    
                @*<div class="item active">
                    <img src="//placehold.it/1800x900" data-color="firebrick" alt="First Image">
                    <div class="carousel-caption">
                        <h3>First Image</h3>
                    </div>
                </div>
                <div class="item">
                    <img src="//placehold.it/1800x900" data-color="firebrick" alt="Second Image">
                    <div class="carousel-caption">
                        <h3>Second Image</h3>
                    </div>
                </div>*@
    
            </div>
            <!-- Controls -->
            <a class="left carousel-control" href="#mycarousel" role="button" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="right carousel-control" href="#mycarousel" role="button" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>
    
        @RenderBody()
    
    </div>
    

    这是宏部分视图[GalleryImages.cshtml]

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    
    @if (CurrentPage.HasValue("carouselGallery"))
    {
        var carouselGalleryList = CurrentPage.carouselGallery.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        var carouselGalleryCollection = Umbraco.Media(carouselGalleryList);
    
        foreach (var carouselGalleryImage in carouselGalleryCollection)
        {
            <img src="@carouselGalleryImage.Url" />
        }
    
    }
    

0 个答案:

没有答案
相关问题