How to Enable Bootstrap 4 Carousel Inside a Bootstrap Popover
up vote
1
down vote
favorite
can you please take a look at this demo and let me know why controll buttons are not working on Bootstrap 4 Carousel Inside a Bootstrap Popover? As you can see The carousel is working as I already added
$("[data-toggle=popover]").on('shown.bs.popover', function ()
$('.carousel-inner').carousel();
);
but controls are not working
$("[data-toggle=popover]").each(function(i, obj)
$(this).popover(
html: true,
content: function()
var id = $(this).attr('id')
return $('#popover-content-' + id).html();
);
);
$("[data-toggle=popover]").on('shown.bs.popover', function()
$('.carousel-inner').carousel();
);
.carousel-inner img
width: 100%;
height: 100%;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
<a class="btn btn-primary" data-toggle="popover" data-container="body" data-placement="right" type="button" data-html="true" href="#" id="login">Display</a>
<div id="popover-content-login" class="d-none">
<div id="demo" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.w3schools.com/bootstrap4/la.jpg" alt="Los Angeles" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/chicago.jpg" alt="Chicago" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/ny.jpg" alt="New York" width="1100" height="500">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
javascript jquery twitter-bootstrap bootstrap-4
add a comment |
up vote
1
down vote
favorite
can you please take a look at this demo and let me know why controll buttons are not working on Bootstrap 4 Carousel Inside a Bootstrap Popover? As you can see The carousel is working as I already added
$("[data-toggle=popover]").on('shown.bs.popover', function ()
$('.carousel-inner').carousel();
);
but controls are not working
$("[data-toggle=popover]").each(function(i, obj)
$(this).popover(
html: true,
content: function()
var id = $(this).attr('id')
return $('#popover-content-' + id).html();
);
);
$("[data-toggle=popover]").on('shown.bs.popover', function()
$('.carousel-inner').carousel();
);
.carousel-inner img
width: 100%;
height: 100%;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
<a class="btn btn-primary" data-toggle="popover" data-container="body" data-placement="right" type="button" data-html="true" href="#" id="login">Display</a>
<div id="popover-content-login" class="d-none">
<div id="demo" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.w3schools.com/bootstrap4/la.jpg" alt="Los Angeles" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/chicago.jpg" alt="Chicago" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/ny.jpg" alt="New York" width="1100" height="500">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
javascript jquery twitter-bootstrap bootstrap-4
Can you try addingcontainer: 'body'
to your popover options?
– TheUnreal
Nov 11 at 16:59
Thanks TheUnreal, I did! nothing changed!
– Behseini
Nov 12 at 2:50
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
can you please take a look at this demo and let me know why controll buttons are not working on Bootstrap 4 Carousel Inside a Bootstrap Popover? As you can see The carousel is working as I already added
$("[data-toggle=popover]").on('shown.bs.popover', function ()
$('.carousel-inner').carousel();
);
but controls are not working
$("[data-toggle=popover]").each(function(i, obj)
$(this).popover(
html: true,
content: function()
var id = $(this).attr('id')
return $('#popover-content-' + id).html();
);
);
$("[data-toggle=popover]").on('shown.bs.popover', function()
$('.carousel-inner').carousel();
);
.carousel-inner img
width: 100%;
height: 100%;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
<a class="btn btn-primary" data-toggle="popover" data-container="body" data-placement="right" type="button" data-html="true" href="#" id="login">Display</a>
<div id="popover-content-login" class="d-none">
<div id="demo" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.w3schools.com/bootstrap4/la.jpg" alt="Los Angeles" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/chicago.jpg" alt="Chicago" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/ny.jpg" alt="New York" width="1100" height="500">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
javascript jquery twitter-bootstrap bootstrap-4
can you please take a look at this demo and let me know why controll buttons are not working on Bootstrap 4 Carousel Inside a Bootstrap Popover? As you can see The carousel is working as I already added
$("[data-toggle=popover]").on('shown.bs.popover', function ()
$('.carousel-inner').carousel();
);
but controls are not working
$("[data-toggle=popover]").each(function(i, obj)
$(this).popover(
html: true,
content: function()
var id = $(this).attr('id')
return $('#popover-content-' + id).html();
);
);
$("[data-toggle=popover]").on('shown.bs.popover', function()
$('.carousel-inner').carousel();
);
.carousel-inner img
width: 100%;
height: 100%;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
<a class="btn btn-primary" data-toggle="popover" data-container="body" data-placement="right" type="button" data-html="true" href="#" id="login">Display</a>
<div id="popover-content-login" class="d-none">
<div id="demo" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.w3schools.com/bootstrap4/la.jpg" alt="Los Angeles" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/chicago.jpg" alt="Chicago" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/ny.jpg" alt="New York" width="1100" height="500">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
$("[data-toggle=popover]").each(function(i, obj)
$(this).popover(
html: true,
content: function()
var id = $(this).attr('id')
return $('#popover-content-' + id).html();
);
);
$("[data-toggle=popover]").on('shown.bs.popover', function()
$('.carousel-inner').carousel();
);
.carousel-inner img
width: 100%;
height: 100%;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
<a class="btn btn-primary" data-toggle="popover" data-container="body" data-placement="right" type="button" data-html="true" href="#" id="login">Display</a>
<div id="popover-content-login" class="d-none">
<div id="demo" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.w3schools.com/bootstrap4/la.jpg" alt="Los Angeles" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/chicago.jpg" alt="Chicago" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/ny.jpg" alt="New York" width="1100" height="500">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
$("[data-toggle=popover]").each(function(i, obj)
$(this).popover(
html: true,
content: function()
var id = $(this).attr('id')
return $('#popover-content-' + id).html();
);
);
$("[data-toggle=popover]").on('shown.bs.popover', function()
$('.carousel-inner').carousel();
);
.carousel-inner img
width: 100%;
height: 100%;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="container">
<a class="btn btn-primary" data-toggle="popover" data-container="body" data-placement="right" type="button" data-html="true" href="#" id="login">Display</a>
<div id="popover-content-login" class="d-none">
<div id="demo" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://www.w3schools.com/bootstrap4/la.jpg" alt="Los Angeles" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/chicago.jpg" alt="Chicago" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="https://www.w3schools.com/bootstrap4/ny.jpg" alt="New York" width="1100" height="500">
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
javascript jquery twitter-bootstrap bootstrap-4
javascript jquery twitter-bootstrap bootstrap-4
asked Nov 11 at 16:52
Behseini
2,260154283
2,260154283
Can you try addingcontainer: 'body'
to your popover options?
– TheUnreal
Nov 11 at 16:59
Thanks TheUnreal, I did! nothing changed!
– Behseini
Nov 12 at 2:50
add a comment |
Can you try addingcontainer: 'body'
to your popover options?
– TheUnreal
Nov 11 at 16:59
Thanks TheUnreal, I did! nothing changed!
– Behseini
Nov 12 at 2:50
Can you try adding
container: 'body'
to your popover options?– TheUnreal
Nov 11 at 16:59
Can you try adding
container: 'body'
to your popover options?– TheUnreal
Nov 11 at 16:59
Thanks TheUnreal, I did! nothing changed!
– Behseini
Nov 12 at 2:50
Thanks TheUnreal, I did! nothing changed!
– Behseini
Nov 12 at 2:50
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250996%2fhow-to-enable-bootstrap-4-carousel-inside-a-bootstrap-popover%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you try adding
container: 'body'
to your popover options?– TheUnreal
Nov 11 at 16:59
Thanks TheUnreal, I did! nothing changed!
– Behseini
Nov 12 at 2:50