I am trying to add a caption under an image which is responsive so my code looks like this
function showVideo(obj) {
$("#youtube").attr("src", $(obj).data("src"));
$('#videoModalLabel').text($(obj).data("title"));
$("#videoModal").on("hide.bs.modal", function() {
$("#youtube").removeAttr("src");
}).modal('show');
}
figure {
display: inline-block;
}
figcaption {
margin: 10px 0 0 0;
font-variant: small-caps;
font-family: Arial;
font-weight: bold;
color: #bb3333;
}
figure {
padding: 5px;
}
.vid img:hover {
transform: scale(1.1);
-ms-transform: scale(1.1);
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
}
.vid img {
transition: transform 0.2s;
-webkit-transition: -webkit-transform 0.2s;
-moz-transition: -moz-transform 0.2s;
-o-transition: -o-transform 0.2s;
padding: 1px;
border: 1px solid #021a40;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="row vid">
<figure>
<img class="img-responsive" src="resources/image/18/85/a.jpg" data-title='Want this to be same as figcaption' data-src="https://www.youtube.com/embed/path-to video?autoplay=1" onclick="showVideo(this)" />
<figcaption>
This is long text which overlaps the caption beside it I Want it to break automatically according to window size
</figcaption>
</figure>
</div>
Here I have two issues:
My caption is long so it goes out of the way and I want my data title to become <figcaption>
so I dont have to rewrite it