how to implement dynamic autoupdate of title bar in vue? - html

I am very new to web dev and i am trying to resolve this issue from quite some time, please help me with this,
I have implemented a series of verticle slides each slide contains 10 images and every time i reach bottom i call next images from api call. now i wish to print no. of slide i am presently active on I used below code for it but this way on going to top or below value of slide no. increments and finally becomes constant.
<div class="left">
{{slideno}}
</div>
<div v-for="(images, index) in slides"
:key="index" >{{setslideNumber(index)}}
<div class="container read">
<div
class="col-md-offset-1 col-md-11 col-sm-2 col-xs-12 reader-section"
>
<div
id="carousel-pager"
class="carousel slide "
data-ride="carousel"
data-interval="1000"
>
<div class="carousel-inner vertical">
<div class=" item" style="object-fit: fill;">
<div
v-for="(image, index) in images"
:key="index"
class="section"
style="color:#fff"
>
<img
:src="
image
"
class="img-responsive"
data-target="#carousel-main"
data-slide-to="0"
width:100
/>
</div>
<div v-if="images.length" v-observe-visibility="handleScrolledToBottom"></div>
</div>
</div>
<a
class="left carousel-control"
href="#carousel-pager"
role="button"
data-slide="prev"
>
<span
class="glyphicon glyphicon-chevron-up"
aria-hidden="true"
></span>
<span class="sr-only">Previous</span>
</a>
<a
class="right carousel-control"
href="#carousel-pager"
role="button"
data-slide="next"
>
<span
class="glyphicon glyphicon-chevron-down"
aria-hidden="true"
></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>
</div>
methods: {
setSlideNumber(index){
this.slideno=index+1;
},
}
what value of sliden0 i am getting: 123....10
what i need the value of slide that is visible,

Related

Bootstrap carousel is filling my whole page

I would like a carousel that fills about half of the window. I've been reading through the documentation https://getbootstrap.com/docs/4.1/components/carousel/ and a following a youtube tutorial for help https://youtu.be/9cKsq14Kfsw?t=3510. My images fill the entire page plus more (when scrolled down) and I can't figure out how to make it smaller other than setting a fixed height in CSS which makes the image look squashed.
Here is my code
html, body {
width: 100%;
height: 100%;
}
.carousel-inner img {
width: 100%;
height: 100%;
}
<!-- Image carousel -->
<div id="slides" class="carousel slide" data-ride="carousel">
<!-- Carousel images -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img/home-1.png" />
<div class="carousel-caption">
<h1 class="display-2">Garnet Home Inspections</h1>
</div>
</div>
<div class="carousel-item">
<img src="img/home-2.png" />
<div class="carousel-caption">
<h1 class="display-3">Service Area</h1>
<h3>I travel all over the capital Region</h3>
<button type="button" class="btn btn-outline-light btn-lg">SET UP AN APPOINTMENT</button>
</div>
</div>
<div class="carousel-item">
<img src="img/home-3.png" />
<div class="carousel-caption">
<!-- put content here -->
</div>
</div>
</div>
<!-- Carousel buttons-->
<a class="carousel-control-prev" href="#slides" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span> <!-- Screenreaders only -->
</a>
<a class="carousel-control-next" href="#slides" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span> <!-- Screenreaders only -->
</a>
</div>
Thank you in advance :)
If anyone needs more information/code please let me know.

Dynamically loaded slider using bootstrap

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)

bootstrap carousel two slide shows appear simultaneously

I have several photo albums (thumbnails, links) on one page. The idea is that when the user clicks on the thumbnail the bootstrap carousel slide show pops up with pictures from this album.
The HTML for one of the albums looks like this (the second one is identical):
<div class="container">
<div class="row">
<!-- Album 1 -->
<div class="col-sm-12 col-md-3 col-lg-3 box">
<span class="spanner"></span>
<div class=thumbnail style="background-image: url(image1.jpg);">
<div class="caption">
<h4>Album 1</h4>
<p class="photo-text">Album 1 description</p>
</div>
</div>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img class="img-responsive" src="image1.jpg" alt="image1">
</div>
<div class="item">
<img class="img-responsive" src="image2.jpg" alt="image2">
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
The problem is when I press on the album thumbnail both slide shows pop-up. I assume the problem is with "active" but I am not sure how to fix it. Thanks!
Check and make sure both carousels have a different id. Are you using the id to load the carousel?

How can I arrange this DIVs in partial view using bootstrap or Css?

I'm developing an online-store website using Asp.net MVC 5 and Razor Engine. I have a View for show products using Carousel . I show a small image of products in right of page (GoodDetails.cshtml) and then show more details in _GoodDetailsAjax.cshtml .
GoodDetails.cshtml
<div >
<div class="row">
<div class="col-lg-9 col-md-9" id="DivAjax">
#{Html.RenderAction("GoodDetailsAjax", new { id = Model.GoodDetails.FirstOrDefault().DetailsGoodID });}
</div>
<div class="col-lg-2 col-md-2 pull-right center-block" >
#foreach (var item1 in Model.GoodDetails)
{
<div>
<input type="image" class="img-responsive" src="~/Images/GoodDetails/#item1.DetailsSmallImage1">
</div>
#Ajax.ActionLink(#item1.DetailsName, "GoodDetailsAjax", new { id = #item1.DetailsGoodID }, new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "DivAjax",
InsertionMode = InsertionMode.Replace
})
}
</div>
</div>
I want to full screen that div with InfoDiv id . How can I do it ? I tried Css and very bootstrap classes but I couldn't do it .
Thanks in advance .
_GoodDetailsAjax.cshtml
<div class="row container">
#foreach (var item in Model.GoodDetails)
{
<div style="height:auto;" class="carousel slide article-slide col-md-12 col-lg-12" id="article-photo-carousel">
<!-- Wrapper for slides -->
<div style="border:1px solid;" class="carousel-inner cont-slider">
<div class="item active">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage1">
</div>
<div class="item">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage2">
</div>
<div class="item">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage3">
</div>
<div class="item">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage4">
</div>
</div>
<!-- Indicators -->
<ol class="carousel-indicators text-center col-lg-12 col-md-12" >
<li class="active" data-slide-to="0" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage1">
</li>
<li data-slide-to="1" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage2">
</li>
<li data-slide-to="2" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage3">
</li>
<li data-slide-to="3" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage4">
</li>
</ol>
<a style="background:none !important;" class="left carousel-control" href="#article-photo-carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a style="background:none !important;" class="right carousel-control" href="#article-photo-carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div id="InfoDiv" class="col-lg-12 col-md-12 " >
<p>#item.DetailsExtraInfo</p>
<p>#item.DetailsProducer</p>
<p>#item.DetailsSize</p>
}
</div>
You are updating the below code with ajax
<div class="col-lg-9 col-md-9" id="DivAjax">
#{Html.RenderAction("GoodDetailsAjax", new { id = Model.GoodDetails.FirstOrDefault().DetailsGoodID });}
</div>
This <div> has class="col-lg-9 col-md-9" so your partial view will also renders in the div with same class of class="col-lg-9 col-md-9". So this is the reason why your div in partial view is not full width.
You have to update the row code with ajax like below
<div class="col-md-12" id="DivAjax">
<div class="row">
<div class="col-lg-9 col-md-9" >
</div>
<div class="col-lg-2 col-md-2 pull-right center-block" >
#foreach (var item1 in Model.GoodDetails)
{
<div>
<input type="image" class="img-responsive" src="~/Images/GoodDetails/#item1.DetailsSmallImage1">
</div>
#Ajax.ActionLink(#item1.DetailsName, "GoodDetailsAjax", new { id = #item1.DetailsGoodID }, new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "DivAjax",
InsertionMode = InsertionMode.Replace
})
}
</div>
</div>
</div>
and in the partial view
<div class="row container">
#foreach (var item in Model.GoodDetails)
{
<div class="row">
<div class="col-md-9">
<div style="height:auto;" class="carousel slide article-slide col-md-12 col-lg-12" id="article-photo-carousel">
<!-- Wrapper for slides -->
<div style="border:1px solid;" class="carousel-inner cont-slider">
<div class="item active">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage1">
</div>
.
<li data-slide-to="3" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage4">
</li>
</ol>
<a style="background:none !important;" class="left carousel-control" href="#article-photo-carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a style="background:none !important;" class="right carousel-control" href="#article-photo-carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="col-md-2">
#foreach (var item1 in item)
{
<div>
<input type="image" class="img-responsive" src="~/Images/GoodDetails/#item1.DetailsSmallImage1">
</div>
#Ajax.ActionLink(#item1.DetailsName, "GoodDetailsAjax", new { id = #item1.DetailsGoodID }, new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "DivAjax",
InsertionMode = InsertionMode.Replace
})
}
</div>
</div>
<div class="row">
<div id="InfoDiv" class="col-lg-12 col-md-12 " >
<p>#item.DetailsExtraInfo</p>
<p>#item.DetailsProducer</p>
<p>#item.DetailsSize</p>
</div>
</div>
}
</div>
You have to place the ajax form inside the partial view and for that you have to do little customize to your code
hope this will help you
There is small organisational error in your _GoodDetailsAjax.cshtml file as per Bootstrap. You have added col-md-12 after col-lg-12 which should be other way around.
GoodDetails.cshtml
<div class="container">
<div class="row">
<div class="col-md-9 col-lg-9" id="DivAjax">
<!-- product details starts -->
#{Html.RenderAction("GoodDetailsAjax", new { id = Model.GoodDetails.FirstOrDefault().DetailsGoodID });}
<!-- Product details ends -->
</div>
<div class="col-md-3 col-lg-3 pull-right center-block" >
#foreach (var item1 in Model.GoodDetails)
{
<div>
<input type="image" class="img-responsive" src="~/Images/GoodDetails/#item1.DetailsSmallImage1">
</div>
#Ajax.ActionLink(#item1.DetailsName, "GoodDetailsAjax", new { id = #item1.DetailsGoodID }, new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "DivAjax",
InsertionMode = InsertionMode.Replace
})
}
</div>
</div>
</div>
_GoodDetailsAjax.cshtml
<div class="row">
#foreach (var item in Model.GoodDetails)
{
<div class="carousel slide article-slide" id="article-photo-carousel">
<!-- Wrapper for slides -->
<div style="border:1px solid;" class="carousel-inner cont-slider">
<div class="item active">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage1">
</div>
<div class="item">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage2">
</div>
<div class="item">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage3">
</div>
<div class="item">
<img alt="" title="" src="~/Images/GoodDetails/#item.DetailsImage4">
</div>
</div>
<!-- Indicators -->
<ol class="carousel-indicators text-center" >
<li class="active" data-slide-to="0" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage1">
</li>
<li data-slide-to="1" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage2">
</li>
<li data-slide-to="2" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage3">
</li>
<li data-slide-to="3" data-target="#article-photo-carousel">
<img alt="" src="~/Images/GoodDetails/#item.DetailsSmallImage4">
</li>
</ol>
<a style="background:none !important;" class="left carousel-control" href="#article-photo-carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a style="background:none !important;" class="right carousel-control" href="#article-photo-carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div id="InfoDiv" class="" >
<p>#item.DetailsExtra0nfo</p>
<p>#item.DetailsProducer</p>
<p>#item.DetailsSize</p>
}
</div>
</div>
Fiddle: https://jsfiddle.net/dg0n28z5/3/
Hope that make sense.

Making back image blur and front image clearly visible

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;