I have the following design for a carousel slider
The first slide has a larger main image (and 4 smaller)
The second slide is split between 8 smaller images
The screenshots attached were built using bootstrap - something like this
<div class="item active">
<div class="col-xs-6 grid-col">
<img src="~/img01">
</div>
<div class="col-xs-3 grid-col">
<img src="~/img02">
<img src="~/img03">
</div>
<div class="col-xs-3 grid-col">
<img src="~/img04">
<img src="~/img05">
</div>
</div>
<div class="item">
<div class="col-xs-3 grid-col">
<img src="~/img06">
<img src="~/img07">
</div>
<div class="col-xs-3 grid-col">
<img src="~/img08">
<img src="~/img09">
</div>
<div class="col-xs-3 grid-col">
<img src="~/img01">
<img src="~/img02">
</div>
<div class="col-xs-3 grid-col">
<img src="~/img03">
<img src="~/img04">
</div>
</div>
Of course that was easy! Now I need to dynamically load my images it's got a lot more complicated.....
This is how my razor markup looks currently
<div class="listing-slider-grid">
<div class="row grid-row" id="listingSlider">
<div id="carouselListingSlider" class="carousel slide" data-ride="carousel" data-interval="4000">
<div class="carousel-inner" data-toggle="modal" data-target=".carousel-modal">
#foreach (var slide in Model.ListingSliderImages.ToArray().Split(8))
{
<div class="item #(firstItemInSlider ? "active" : "")">
#foreach (var row in slide.ToArray().Split(4))
{
<div class="row">
#foreach (var item in row)
{
<div class="col-xs-3">
<img class="small-slider-img" src="~/images/optimisedImages/testing-slider-images/#item.ImageDefinition.Url">
</div>
}
</div>
}
</div>
firstItemInSlider = false;
}
</div>
<a class="left carousel-control" href="#carouselListingSlider" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carouselListingSlider" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
</div>
And on screen the two slides are looking like this
not too bad but I haven't managed to get that larger image in (and I have issues on slider two when there aren't enough images to populate a full slide).
I'm really stumped with how to get that first large image when rendering a list using the Bootstrap grid system (I've been using this helpful article https://www.jerriepelser.com/blog/approaches-when-rendering-list-using-bootstrap-grid-system/)
Does anyone have any better ideas?
Thanks, Sam
You should make exception in the loop to set more width (xs-6) for that element:
<div class="row">
#foreach (var item in row)
{
if([Your condition]) {
<div class="col-xs-6">
<img class="small-slider-img" src="~/images/optimisedImages/testing-slider-images/#item.ImageDefinition.Url">
</div>
} else { // Current behavior
<div class="col-xs-3">
<img class="small-slider-img" src="~/images/optimisedImages/testing-slider-images/#item.ImageDefinition.Url">
</div>
}
}
</div>
If you add an xs-6 you have to modify the rest of the row, so all of them never exceed 12 value (maximum columns per row)
Related
I'm working on making a site, and im currently dealing with BS4.1.3
I'm still new to this world so i have this issue right now:
<div class="container">
<nav class="navbar sticky-top">
<div class="grid">
<div class="row">
<div class="col-md-4">
<a class="btn btn-primary" data-toggle="collapse" href="#collapse-top-menu" role="button" aria-expanded="false" aria-controls="collapse-top-menu">
<img src="img/baseline-menu-24px.svg">
</a>
</div>
<div class="col-md-4">
<a class="navbar-brand" href="#">
<img src="img/bootstrap-solid.svg" width="40" height="40">
</a>
</div>
<div class="col-md-4">
Test
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="collapse" id="collapse-top-menu">
<input type="text" class="form-control" id="input-top-collapse-search" placeholder="Cosa stai cercando?">
</div>
</div>
</div>
</div>
</nav>
</div>
But the end result it's like this
While i wanted that the first blue button and the "logo" (B) were aligned, "test" a lot more in the right part of the navbar
Also the bottom search bar should be the same width as the container, so full lenght
<div class="container">
<nav class="navbar sticky-top">
<div class="grid">
<div class="row">
<div class="col-md-4">
<a class="btn btn-primary" data-toggle="collapse" href="#collapse-top-menu" role="button" aria-expanded="false" aria-controls="collapse-top-menu">
<img src="img/baseline-menu-24px.svg">
</a>
</div>
<div class="col-md-8 pull-right">
<a class="navbar-brand" href="#">
<img src="img/bootstrap-solid.svg" width="40" height="40">
<span>Test</span>
</a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="collapse" id="collapse-top-menu">
<input type="text" class="form-control" id="input-top-collapse-search" placeholder="Cosa stai cercando?">
</div>
</div>
</div>
</div>
</nav>
</div>
.collapse input{
width:100%;
}
I am on mobile Stack Overflow app hence not able to test this.
In Bootstap 4, to put the test at the right of the navbar you can try,
<ul class="navbar-nav ml-auto">The content which goes to right comes here as a li</ul>
Also for aligning the blue button (The button you are using here is called as hamburger, remember that) can be aligned by using some margin-top for it.
Just use a CSS selector to select the hamburger and give some margin-top property to it.
Please consider adding a codepen so that we mobile users can play around with your code.
I have one row and two columns in it. Right column's content overlaps to left column. Here is my codes.
Even in the large screen I see that (in below code) <div class="row hidden-xs" style="border-bottom: 2px solid lightgray;">
this border overlaps to left.
Here is how it looks
How do I prevent overlapping their contents?
<div class="row">
<div class="col-lg-2" style="letter-spacing: 1px;">
<img src="~/Content/images/kitap/kitap2.jpg" style="width:250px; height:350px;"/>
<h5><b>ISBN:</b>1234567891</h5>
<h5><b>Kapak Türü:</b> Sert Kapak</h5>
<h5><b>Baskı No:</b>16</h5>
<h5><b>Yayınevi:</b>Publishing </h5>
<h5><b>Yıl:</b> 2005</h5>
</div>
<div class="col-lg-10">
<ul class="nav nav-tabs">
<li class="active">Yeni ve 2. El</li>
<li>Kirala</li>
<li>Kitap Detaylı Bilgileri</li>
<li>Kitap Yorumları</li>
</ul>#*nav nav-tabs*#
<div class="tab-content">
<div class="tab-pane active" id="satinAl">
<div class="row hidden-xs" style="border-bottom: 2px solid lightgray;">
<div class="col-md-3">
<h5><b>Fiyat + Kargo</b></h5>
</div>
<div class="col-md-3">
<h5><b>Kitabın Durumu</b></h5>
</div>
<div class="col-md-3">
<h5><b>Tahmini Teslim Tarihi</b></h5>
</div>
<div class="col-md-3">
<h5><b>Satıcı Bilgileri</b></h5>
</div>
</div> #*Başlık 1. row*#
<div class="row">
<div class="col-md-3">
<h5><b>39.87 TL</b></h5>
<h6>3.99 TL Kargo</h6>
</div>
<div class="col-md-3">
<h5><b>Çok İyi</b></h5>
<h6>Kitap çok iyi durumdadır. Çizgi karalam yoktur. Çok iyi müşteri hizmetleri. Alan Memnun</h6>
</div>
<div class="col-md-3">
<h5><b>Feb. 24 - Mar. 3.</b></h5>
<h6>Satıcı İade Politikası</h6>
</div>
<div class="col-md-3">
<h5><b>Jenny Blue</b></h5>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
100% Pozitif
</div>
</div> #*Ilk Satıcı 2. row*#
</div>#*tab-pane active Satın Al*#
<div class="tab-pane" id="kirala">
<p>Çok yakında hizmetinizde</p>
</div>
</div>#*tab-content*#
</div>#*col-md-10*#
</div>#*row*#
To make columns to behave responsively you need to remove fixed dimensions of image:
<img src="~/Content/images/kitap/kitap2.jpg" style="width:250px; height:350px;"/>
and set class="img-responsive" to it:
<img src="~/Content/images/kitap/kitap2.jpg" class="img-responsive"/>
here is a working example
It is because the image is bigger than the column.
You need either to use bootstrap img-responsive class and remove the width and height attributes in img
or
make the cols bigger , ex: use col-lg-4 for the first column and col-lg-8 for the second column.
looks fine on computer, on tablet in horizontal it seems to crop into image "center".. on phones it crops into center even more not showing all the image.
code in source code view (dreamweaver)
<main id="main" class="site-main">
<section id="carousel-1" class="carousel slide section-slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active" style="background: url(images/bg-1.jpg);">
<div class="container"><img src="http://roncartist.com/images/copyright_protected-1.png" alt="First slide"></div>
</div>
<div class="item" style="background: url(images/bg-2.jpg);">
<div class="container"><img src="http://placehold.it/640x340" alt="Second slide"></div>
</div>
<div class="item" style="background: url(images/bg-3.jpg);">
<div class="container"><img src="http://placehold.it/640x340" alt="Third slide"></div>
</div>
</div>
<a class="left carousel-control" href="#carousel-1" data-slide="prev"><span class="fa fa-chevron-left"></span></a>
<a class="right carousel-control" href="#carousel-1" data-slide="next"><span class="fa fa-chevron-right"></span></a>
example image
You have to aplly background-size:cover to the element .item
It stretch the background image to completely cover the content area.
Let me know if works.
I have a list of media cards. At a time 6 cards are displayed and to view next set of media cards I need to swipe right/left. How can I do this using angular ngtouch.
This is what I have for html
<div class="media people-card-media col-xs-12" ng-repeat="item in heroes">
<div class="media-left ">
<div class="person-photo presence" >
<img class="media-object list__photo img-circle" ng-src="{{item.photo}}" />
</div>
</div>
<div class="media-body list__body">
<div class="people_name_title">
<h4 class="media-heading title">{{item.name}}</h4>
</div>
</div>
<div class="media-right media-middle contacts-chat-call flex-it-align-top">
<a style="margin-right: 10px;">
call
</a>
</div>
</div>
here is the plunker
http://plnkr.co/edit/XRyEwpVNXiaejojm8lEY?p=preview
any help appreciated
https://github.com/revolunet/angular-carousel solved my problem. You turn any ul li elements to carousel
I was working with carosel in bootstrap and I want background image to be blur and top image to be properly visible. For this I was using two classes in style but as a result both front and back images are coming blur. The fiddle for the same is here https://jsfiddle.net/v37wju8h/6/ . Please increase the screen size to check the problem with the result. Below is the code -
<div class="container">
<div id="carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner"> <!-- Wrapper for slides -->
<div class="item active back_img" style="background-image:url('http://www.pluots.net/media/full/18/dining-table-contemporary-in-wood-home-fred-by-vladimir-dining-table-contemporary-in-wood-home-fred-by-vladimir.jpg');">
<img class="front_img" src="http://www.pluots.net/media/full/18/furniture-tips-to-make-marvellous-round-dining-table-furniture-tips-to-make-marvellous-round-dining-table.jpg"/>
<div class="carousel-caption">
<h3>Image1</h3>
</div>
</div>
<div class="item back_img" style="background-image:url('http://www.pluots.net/media/full/18/dining-table-contemporary-in-wood-home-fred-by-vladimir-dining-table-contemporary-in-wood-home-fred-by-vladimir.jpg');">
<img class="front_img" src="http://www.pluots.net/media/full/18/furniture-tips-to-make-marvellous-round-dining-table-furniture-tips-to-make-marvellous-round-dining-table.jpg" />
<div class="carousel-caption">
<h3>Image2 </h3>
</div>
</div>
<div class="item back_img" style="background-image:url('http://www.pluots.net/media/full/18/dining-table-contemporary-in-wood-home-fred-by-vladimir-dining-table-contemporary-in-wood-home-fred-by-vladimir.jpg');">
<img class="front_img" src="http://www.pluots.net/media/full/18/furniture-tips-to-make-marvellous-round-dining-table-furniture-tips-to-make-marvellous-round-dining-table.jpg" />
<div class="carousel-caption">
<h3>Image 3</h3>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#carousel" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
You can use opacity
opacity: 0.5
position: relative;