I have implemented a twitter bootstrap 3 carousel into my page but have run into an issue with it. After sliding content showing blank.
<!-- CAROUSEL -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" style="background-color:#B0A7A1 solid 1px;">
<!-- INDICATORS -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- INDICATORS END -->
<!-- CAROUSEL INNER CONTENT -->
<div class="carousel-inner" role="listbox">
<!-- ITEM 1 -->
<div class="active item">
<img src="images/slider-bg.png">
<div class="container">
<div class="carousel-caption">
<h3 style="margin: 5px 0;">Senior Account Officers</h3>
<h5>Description</h5>
<h5 class="text-justify">If you're viewing this page via a the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</h5>
<p><a class="btn btn-sm btn-danger" href="#">Read More</a></p>
</div>
</div>
</div>
<!-- ITEM 1 -->
<!-- ITEM 2 -->
<div class="item">
<img src="images/slider-bg.png">
<div class="container">
<div class="carousel-caption">
<h3 style="margin: 5px 0;">Felcon India required Experienced CA Officer</h3>
<h5>Description</h5>
<h5 class="text-justify">If you're viewing this page via a the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</h5>
<p><a class="btn btn-sm btn-danger" href="#">Read More</a></p>
</div>
</div>
</div>
<!-- ITEM 2 -->
<!-- ITEM 3 -->
<div class="item">
<img src="images/slider-bg.png">
<div class="container">
<div class="carousel-caption">
<h3 style="margin: 5px 0;">Ca Fresher Internship Program</h3>
<h5>Description</h5>
<h5 class="text-justify" >If you're viewing this page via a the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules.</h5>
<p><a class="btn btn-sm btn-danger" href="#">Read More</a></p>
</div>
</div>
</div>
<!-- ITEM 3 -->
</div>
<!-- CAROUSEL INNER CONTENT END -->
</div>
<!-- CAROUSEL END HERE -->
Any help would be appreciated. I have initialized the bootstrap .js file.
Related
Index.cshtml
#using eCommerceStatic.Models;
#model IEnumerable<ProductModel>
#{
//ViewBag.Title = "Index";
}
<!--Carousel Wrapper-->
<div id="carousel-example-1z" class="carousel slide carousel-fade pt-4" data-ride="carousel">
<!--Indicators-->
<ol class="carousel-indicators">
<li data-target="#carousel-example-1z" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-1z" data-slide-to="1"></li>
<li data-target="#carousel-example-1z" data-slide-to="2"></li>
</ol>
<!--/.Indicators-->
<!--Slides-->
<div class="carousel-inner" role="listbox">
<!--First slide-->
<div class="carousel-item active">
<div class="view" style="background-image: url('https://mdbootstrap.com/img/Photos/Horizontal/E-commerce/8-col/img%282%29.jpg'); background-repeat: no-repeat; background-size: cover;">
<!-- Mask & flexbox options-->
<div class="mask rgba-black-strong d-flex justify-content-center align-items-center">
<!-- Content -->
<div class="text-center white-text mx-5 wow fadeIn">
<h1 class="mb-4">
<strong>Learn Bootstrap 4 with MDB</strong>
</h1>
<p>
<strong>Best & free guide of responsive web design</strong>
</p>
<p class="mb-4 d-none d-md-block">
<strong>
The most comprehensive tutorial for the Bootstrap 4. Loved by over 500 000 users. Video and
written versions
available. Create your own, stunning website.
</strong>
</p>
<a target="_blank" href="https://mdbootstrap.com/education/bootstrap/" class="btn btn-outline-white btn-lg">
Start
free tutorial
<i class="fas fa-graduation-cap ml-2"></i>
</a>
</div>
<!-- Content -->
</div>
<!-- Mask & flexbox options-->
</div>
</div>
<!--/First slide-->
<!--Second slide-->
<div class="carousel-item">
<div class="view" style="background-image: url('https://mdbootstrap.com/img/Photos/Horizontal/E-commerce/8-col/img%283%29.jpg'); background-repeat: no-repeat; background-size: cover;">
<!-- Mask & flexbox options-->
<div class="mask rgba-black-strong d-flex justify-content-center align-items-center">
<!-- Content -->
<div class="text-center white-text mx-5 wow fadeIn">
<h1 class="mb-4">
<strong>Learn Bootstrap 4 with MDB</strong>
</h1>
<p>
<strong>Best & free guide of responsive web design</strong>
</p>
<p class="mb-4 d-none d-md-block">
<strong>
The most comprehensive tutorial for the Bootstrap 4. Loved by over 500 000 users. Video and
written versions
available. Create your own, stunning website.
</strong>
</p>
<a target="_blank" href="https://mdbootstrap.com/education/bootstrap/" class="btn btn-outline-white btn-lg">
Start
free tutorial
<i class="fas fa-graduation-cap ml-2"></i>
</a>
</div>
<!-- Content -->
</div>
<!-- Mask & flexbox options-->
</div>
</div>
<!--/Second slide-->
<!--Third slide-->
<div class="carousel-item">
<div class="view" style="background-image: url('https://mdbootstrap.com/img/Photos/Horizontal/E-commerce/8-col/img%285%29.jpg'); background-repeat: no-repeat; background-size: cover;">
<!-- Mask & flexbox options-->
<div class="mask rgba-black-strong d-flex justify-content-center align-items-center">
<!-- Content -->
<div class="text-center white-text mx-5 wow fadeIn">
<h1 class="mb-4">
<strong>Learn Bootstrap 4 with MDB</strong>
</h1>
<p>
<strong>Best & free guide of responsive web design</strong>
</p>
<p class="mb-4 d-none d-md-block">
<strong>
The most comprehensive tutorial for the Bootstrap 4. Loved by over 500 000 users. Video and
written versions
available. Create your own, stunning website.
</strong>
</p>
<a target="_blank" href="https://mdbootstrap.com/education/bootstrap/" class="btn btn-outline-white btn-lg">
Start
free tutorial
<i class="fas fa-graduation-cap ml-2"></i>
</a>
</div>
<!-- Content -->
</div>
<!-- Mask & flexbox options-->
</div>
</div>
<!--/Third slide-->
</div>
<!--/.Slides-->
<!--Controls-->
<a class="carousel-control-prev" href="#carousel-example-1z" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel-example-1z" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--/.Controls-->
</div>
<!--/.Carousel Wrapper-->
<!--Main layout-->
#Html.Partial("_GetCategories")
<main>
<div class="container">
<!--Navbar-->
<!--/.Navbar-->
#Html.Partial("_ProductList",Model)
</div>
</main>
<!--Main layout-->
HomeController.cs
public PartialViewResult _GetCategories()
{
return PartialView(_context.Categories.ToList());
}
_GetCategories.cshtml
#model IEnumerable<eCommerceStatic.Entity.Category>
eCommerceStatic.Entity
<nav class="navbar navbar-expand-lg navbar-dark mdb-color lighten-3 mt-3 mb-5">
<!-- Navbar brand -->
<span class="navbar-brand">Kategoriler :</span>
<!-- Collapse button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#basicExampleNav"
aria-controls="basicExampleNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Collapsible content -->
<div class="collapse navbar-collapse" id="basicExampleNav">
<!-- Links -->
#foreach (var category in Model)
{
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="/Home/List/#category.Id">#category.Name</a>
</li>
</ul>
}
<!-- Links -->
<form class="form-inline">
<div class="md-form my-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
</div>
</form>
</div>
<!-- Collapsible content -->
</nav>
Error
Additional information: The model item passed into the dictionary is of type 'System.Collections.Generic.List1[eCommerceStatic.Models.ProductModel]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable1[eCommerceStatic.Entity.Category]'
How can I fix this?
It is because, your Partial View which is:
_GetCategories.cshtml requires #model IEnumerable<eCommerceStatic.Entity.Category>
but your Index.cshtml which is your Main View in this case, requires
#model IEnumerable<ProductModel>
So, you should be using #model IEnumerable<ProductModel> in your _GetCategories.cshtml
In these cases, consider using a common model class. You can do something similar to this:
Create a new Model class,
Create List<ProductModel> and List<Category> properties.
public class ProductsAndCategories
{
public List<ProductModel> Products { get; set; }
public List<Category> Categories { get; set; }
}
So in your Index :
public IActionResult Index()
{
var model = new ProductsAndCategories
{
//Define your IEnumerable<ProductModel>
//Below is an example...
Products = _context.ProductModel.ToList()
};
return View(model);
}
And in your _GetCategories :
public PartialViewResult _GetCategories()
{
var model = new ProductsAndCategories
{
Categories = _context.Categories.ToList()
};
return PartialView(model);
}
CSHTML
Index.cshtml:
#model ProductsAndCategories
and in your _GetCategories.cshtml:
#model ProductsAndCategories
<nav class="navbar navbar-expand-lg navbar-dark mdb-color lighten-3 mt-3 mb-5">
<!-- Navbar brand -->
....
I have a problem with bootstrap row/cell position.
I am generating 6 col in one row and on my dev env locally I dont have this issue, but on production one cell is moved into like third row.
Here is how its looks:
https://screenshots.firefox.com/byRFg1d6kWAPKbc0/www.javascript.ba
Here is also html:
My goal is to have this six cells in two rows
<div class="sections">
<h2 class="heading">Most Viewed News Today</h2>
<div class="clearfix"></div>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<!-- Video Box Start -->
<div class="videobox2">
<figure>
<!-- Video Thumbnail Start -->
<a href="/posts/the-best-node-js">
<img alt="" class="img-responsive hovereffect height14em" src="/system/posts/images/000/000/058/original/open-uri20180902-27786-uhm319.jpg?1535909323">
</a> <!-- Video Thumbnail End -->
<!-- Video Info Start -->
<div class="vidopts">
<ul>
<li><i class="fa fa-eye"></i>43</li>
<li><i class="fa fa-clock-o"></i>02:14 02/09/18</li>
</ul>
<div class="clearfix"></div>
</div>
<!-- Video Info End -->
</figure>
<!-- Video Title Start -->
<h4>The Best Node.js </h4>
<!-- Video Title End -->
</div>
<!-- Video Box End -->
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<!-- Video Box Start -->
<div class="videobox2">
<figure>
<!-- Video Thumbnail Start -->
<a href="/posts/quasar-framework">
<img alt="" class="img-responsive hovereffect height14em" src="/system/posts/images/000/000/053/original/open-uri20180902-27786-1f5glft?1535899755">
</a> <!-- Video Thumbnail End -->
<!-- Video Info Start -->
<div class="vidopts">
<ul>
<li><i class="fa fa-eye"></i>24</li>
<li><i class="fa fa-clock-o"></i>02:14 02/09/18</li>
</ul>
<div class="clearfix"></div>
</div>
<!-- Video Info End -->
</figure>
<!-- Video Title Start -->
<h4>Quasar Framework</h4>
<!-- Video Title End -->
</div>
<!-- Video Box End -->
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<!-- Video Box Start -->
<div class="videobox2">
<figure>
<!-- Video Thumbnail Start -->
<a href="/posts/dependency-injection-smart-table-advanced-patterns">
<img alt="" class="img-responsive hovereffect height14em" src="/system/posts/images/000/000/024/original/javascript1.jpg?1535792343">
</a> <!-- Video Thumbnail End -->
<!-- Video Info Start -->
<div class="vidopts">
<ul>
<li><i class="fa fa-eye"></i>5</li>
<li><i class="fa fa-clock-o"></i>08:08 01/09/18</li>
</ul>
<div class="clearfix"></div>
</div>
<!-- Video Info End -->
</figure>
<!-- Video Title Start -->
<h4>Dependency Injection & Smart Table: Advanced Patterns</h4>
<!-- Video Title End -->
</div>
<!-- Video Box End -->
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<!-- Video Box Start -->
<div class="videobox2">
<figure>
<!-- Video Thumbnail Start -->
<a href="/posts/the-best-node-js">
<img alt="" class="img-responsive hovereffect height14em" src="/system/posts/images/000/000/058/original/open-uri20180902-27786-uhm319.jpg?1535909323">
</a> <!-- Video Thumbnail End -->
<!-- Video Info Start -->
<div class="vidopts">
<ul>
<li><i class="fa fa-eye"></i>43</li>
<li><i class="fa fa-clock-o"></i>02:14 02/09/18</li>
</ul>
<div class="clearfix"></div>
</div>
<!-- Video Info End -->
</figure>
<!-- Video Title Start -->
<h4>The Best Node.js </h4>
<!-- Video Title End -->
</div>
<!-- Video Box End -->
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<!-- Video Box Start -->
<div class="videobox2">
<figure>
<!-- Video Thumbnail Start -->
<a href="/posts/quasar-framework">
<img alt="" class="img-responsive hovereffect height14em" src="/system/posts/images/000/000/053/original/open-uri20180902-27786-1f5glft?1535899755">
</a> <!-- Video Thumbnail End -->
<!-- Video Info Start -->
<div class="vidopts">
<ul>
<li><i class="fa fa-eye"></i>24</li>
<li><i class="fa fa-clock-o"></i>02:14 02/09/18</li>
</ul>
<div class="clearfix"></div>
</div>
<!-- Video Info End -->
</figure>
<!-- Video Title Start -->
<h4>Quasar Framework</h4>
<!-- Video Title End -->
</div>
<!-- Video Box End -->
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<!-- Video Box Start -->
<div class="videobox2">
<figure>
<!-- Video Thumbnail Start -->
<a href="/posts/dependency-injection-smart-table-advanced-patterns">
<img alt="" class="img-responsive hovereffect height14em" src="/system/posts/images/000/000/024/original/javascript1.jpg?1535792343">
</a> <!-- Video Thumbnail End -->
<!-- Video Info Start -->
<div class="vidopts">
<ul>
<li><i class="fa fa-eye"></i>5</li>
<li><i class="fa fa-clock-o"></i>08:08 01/09/18</li>
</ul>
<div class="clearfix"></div>
</div>
<!-- Video Info End -->
</figure>
<!-- Video Title Start -->
<h4>Dependency Injection & Smart Table: Advanced Patterns</h4>
<!-- Video Title End -->
</div>
<!-- Video Box End -->
</div>
</div>
</div>
You could just make 2 rows instead of 1
Each column having col-lg-4 col-md-4 col-sm-4 col-xs-12 (so you would have 3 "cells" in each row) - but of course on smaller screens you have to adjust, hence the col-xs-12
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"><img src="https://picsum.photos/200"></div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"><img src="https://picsum.photos/200"></div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"><img src="https://picsum.photos/200"></div>
</div>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"><img src="https://picsum.photos/200"></div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"><img src="https://picsum.photos/200"></div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"><img src="https://picsum.photos/200"></div>
</div>
I have a grid with a left sidebar and a main content. I'm trying to position a search field on top of the left sidebar, but I can't get it to work. The code is:
<div class="cell medium-auto medium-cell-block-container"> <!-- MAIN CONTENT -->
<div class="grid-x grid-padding-x"> <!-- GRID -->
<div class="cell medium-2 medium-cell-block padding-top-1" data-sticky-container> <!-- LEFT SIDEBAR -->
<div class="input-group sticky" data-sticky data-margin-top="0">
<input class="input-group-field" type="search" id="inputSearch" name="inputSearch" #inputSearch placeholder="Search objects..." (keyup)="onSearchType($event.target.value)">
<div class="input-group-button">
<button class="button primary" [disabled]="!inputSearch.value.length" (click)="onSearchType(''); inputSearch.value=''">Clear</button>
</div>
</div>
<ul class="accordion" data-accordion data-multi-expand="true">
<li class="accordion-item is-active" data-accordion-item>
[....]
</li>
<li class="accordion-item is-active" data-accordion-item>
[....]
</li>
<li class="accordion-item is-active" data-accordion-item>
[....]
</li>
</ul>
</div> <!-- LEFT SIDEBAR -->
<div class="cell medium-10 medium-cell-block padding-top-1"> <!-- CONTENT -->
[....]
</div> <!-- CONTENT -->
</div> <!-- GRID -->
</div> <!-- MAIN CONTENT -->
What I want to position is the 'input-group sticky' div inside the left sidebar. Am I missing something? Thanks!
I have a carousel which is actually a form.
One carousel item is a multi selectbox
How can i auto increase the height on only one carousel-item as the height of the multi select box increase.
The image 1 is how i get.
Image 2 how i want it.
Much thanks for much insights. I cannot refresh the carousel. It will unset my form inputs
<div class="row no-gutters" id="mob-carousel-row" [style.height.px]="mobileCarouselRowHeight">
<div class="col-1 col-sm-1">
<a href="#carouselExampleIndicators" role="button" data-slide="prev">
<i class="fa fa-angle-left mobile-form-nav" ></i>
</a>
</div>
<div class="col-10">
<div
#plMobileCarouselForm
id="carouselExampleIndicators"
class="carousel slide"
data-ride="carousel"
data-interval="false">
<div class="carousel-inner" role="listbox" id="mob-carousel">
<div class="carousel-item active">
<div class="form-group md-form mob inputbox">
<!-- first input box item -->
</div>
</div>
<div class="carousel-item active">
<div class="form-group md-form mob muti-select">
<!-- muti select box item need auto height -->
</div>
</div>
<div class="carousel-item active">
<div class="form-group md-form mob inputbox">
<!-- first input box item -->
</div>
</div>
</div>
</div>
</div>
<div class="col-1 col-sm-1">
<a href="#carouselExampleIndicators" role="button" data-slide="next">
<i class="fa fa-angle-right mobile-form-nav" ></i>
</a>
</div>
</div>
This is intended as a comment but I can't comment yet.
Since you haven't provided your CSS it's just guess work.
However, if you set the height to auto for the container that contains the input forms or select boxes, it will adjust itself as more options become available.
.carousel-item active {
height: auto;
}
I'm working on a project in Bootstrap and I have added a simple image carousel with controls but the problem is that the controls does not work.. See my site here
As you can see you can not press on next and previous buttons to see other images. Here's my code:
<div class="row">
<div class="container">
<div class="col-md-3">
</div>
<div class="col-md-6">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="images/slideshow/1.jpg" alt="Los Angeles" style="width:100%;">
<div class="carousel-caption">
<h3>Los Angeles</h3>
<p>LA is always so much fun!</p>
</div>
</div>
<div class="item">
<img src="images/slideshow/2.jpg" alt="Chicago" style="width:100%;">
<div class="carousel-caption">
<h3>Chicago</h3>
<p>Thank you, Chicago!</p>
</div>
</div>
<div class="item">
<img src="images/slideshow/3.jpg" alt="New York" style="width:100%;">
<div class="carousel-caption">
<h3>New York</h3>
<p>We love the Big Apple!</p>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="col-md-3">
</div>
</div>
</div>
Basically I have not found any kind of mistake in this code ,so if you know what is going wrong please let me know... thanks!
Your code has no problem. But You have used a older version of jQuery. Please update with newer version.
http://take.ms/Rbwmf
You can use this version. It is working perfectly with your code.
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
Thanks
You use the id="myCarousel" several time on this page.
You can only have ONE UNIQUE id per page. Removing the other id="myCarousel" fixes your issue.
Some additional info on IDs:
IDs are here in order for Javascript to target element quite easily. But while they make targeting element with JS easy, they need to be unique otherwise, the script won't be able to know which ID to target. There are many other way to target element with JS but this one stay one of the easiest one.
Small advice: even if you can, don't create IDs for CSS since they are not meant for that. Leave the IDs for use in JS. That will help to keep your code clean consistent.