Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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">‹</a> <a class="carousel-control right" href="#myCarousel" data-slide="next">›</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
Hi Adam,
It's looks like your script doesn't work properly, could you show js code?
Alex
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">‹</a> <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a> </div> }
)) Try to use Visual studio snippet that allows you to close all divs ))
Thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</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
Hi Adam,
It's looks like your script doesn't work properly, could you show js code?
Alex
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">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
}
)) Try to use Visual studio snippet that allows you to close all divs ))
Thanks
is working on a reply...