javascript - Popover Box shadow needs to be for arrow also - Stack Overflow

Bootstrap by default have popover box shadow. but I need the same shadow with popover arrow. How cang

Bootstrap by default have popover box shadow. but I need the same shadow with popover arrow. How can get that shadow for only for arrow border.

This is My-fiddle

Can any one help on this.

$(function () {
    $('#example').popover();
});
a{
  margin-top:100px;
}
.popover-content{
  min-height:200px;
}
<script src=".9.1/jquery.min.js"></script>
<script src=".0.0/js/bootstrap.min.js"></script>

<link href=".2.1/css/font-awesome.min.css" rel="stylesheet"/>
<link href=".0.0/css/bootstrap.min.css" rel="stylesheet"/>


<p>Click on button to see Popover</p>

<a href="#" id="example" class="btn btn-primary" rel="popover"
   data-content="This is the body of Popover"
   data-original-title="Creativity Tuts">pop
</a>

Bootstrap by default have popover box shadow. but I need the same shadow with popover arrow. How can get that shadow for only for arrow border.

This is My-fiddle

Can any one help on this.

$(function () {
    $('#example').popover();
});
a{
  margin-top:100px;
}
.popover-content{
  min-height:200px;
}
<script src="https://ajax.googleapis./ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://netdna.bootstrapcdn./bootstrap/3.0.0/js/bootstrap.min.js"></script>

<link href="https://netdna.bootstrapcdn./font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://netdna.bootstrapcdn./bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>


<p>Click on button to see Popover</p>

<a href="#" id="example" class="btn btn-primary" rel="popover"
   data-content="This is the body of Popover"
   data-original-title="Creativity Tuts">pop
</a>

Share asked Jun 7, 2016 at 13:49 RayuduRayudu 1,8161 gold badge15 silver badges32 bronze badges 2
  • What arrow are you talking about? – wot Commented Jun 7, 2016 at 13:57
  • He means the triangle part that sticks into the button. You can't add a shadow on that unless you want to apply it to the entire little rectangle which is transparent except for the actual triangle. So you'll have a shadow around the box, not the triangle. – Rachel S Commented Jun 7, 2016 at 14:19
Add a ment  | 

1 Answer 1

Reset to default 5

To make a triangular box-shadow you might just rotate a square by 45 degrees and apply the shadow:

.popover.right .arrow:before {
  content: "";
  display:block;
  position:absolute;
  z-index:-1;
  height:14.14px;
  width:14.14px;
  bottom:-8px;
  left:4px;
  background:transparent;
  transform: rotate(45deg);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

I also had to add the background to the content element since the shadow was on top of it. You can also work with overflow:hidden if you can't just add any background (or background color) to content.

.popover-content{
  background-color:#FFF;
}

Fiddle: https://jsfiddle/ke35nzag/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744915955a4600835.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信