Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adam Nilsson 30 posts 130 karma points
    Jun 04, 2013 @ 08:21
    Adam Nilsson
    0

    Carousel issue

    Hi!

    I have done a razor script for my boostrap carusel but i canĀ“t get it to cycle after last item in my script.

    <div id="myCarousel" class="carousel slide">
                <div class="carousel-inner">

                @foreach (var x in sliderimage) {

    <div class="item @x.IsFirst("active")">
                            <img src="@x.umbracoFile" />
                            </div>   

    }

    <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
                <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>
              </div>

    <ol class="carousel-linked-nav pagination">
                <li class="active"><a href="#1">1</a></li>
                <li><a href="#2">2</a></li>
                <li><a href="#3">3</a></li>
            </ol>

    Help needed!

     

    Regard Adam

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jun 04, 2013 @ 10:22
    Alex Skrypnyk
    0

    Hi Adam,

    It's looks like your script doesn't work properly, could you show js code? 

    Alex

  • Adam Nilsson 30 posts 130 karma points
    Jun 04, 2013 @ 10:31
    Adam Nilsson
    100

    It was the famous "div" problem! The closing div for the inner carousel should be before the control links.

    But I had some problem with paging and I downloaded the newest boostrap-carosuel.js from boostraps mainpage and it fixed the problem.

     if(EnableSlider){
          
            <div id="myCarousel" class="carousel slide">
                      
                <ol class="carousel-indicators">
                         @foreach (var item in sliderimage)
                        {
                        <li data-target="#myCarousel" data-slide-to="@counter" class="@item.IsFirst("active")"></li>
                        
                            counter++;
                        }
                        </ol>
                
                <div class="carousel-inner">
                    
                @foreach (var x in sliderimage)
                {
                   
                 if (x.link != ""  ) {
                        var linktopage = Model.NodeById(x.link);
                         <div class="item @x.IsFirst("active")">
                             <a href="@linktopage.Url" target="_blank"><img src="@x.umbracoFile" /></a>
                        </div>
                   }
                    
                    else(x.link == "")
                    {
                        
                        <div class="item @x.IsFirst("active")">
                            <img src="@x.umbracoFile" />
                            </div>        
                                            
                    }
     
                }
          </div>
                  
                <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
                <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>

            </div>
     
      }

     

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jun 04, 2013 @ 12:15
    Alex Skrypnyk
    0

    )) Try to use Visual studio snippet that allows you to close all divs ))

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft