I was trying to change the background of the image caption after the image popup. . When I try to click on the image from the gallery it popup but the caption(Annual function) is in black.
Need to make the background transparent of the caption. When I use any property for making it transparent it becomes white. Caption should have a see-through background.
And I know no one use table to make a website. But I had to do it. Need to make the background transparent of the caption. When I use any property for making it transparent it becomes white. Caption should have a see-through background.
function openModal() {
document.getElementById("myModal").style.display = "block";
}
function closeModal() {
document.getElementById("myModal").style.display = "none";
}
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
var captionText = document.getElementById("caption");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
captionText.innerHTML = this.alt;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.table1 {
font-family: verdana;
font-size: 10px;
font-weight: bold;
}
.menu {
text-decoration: none;
color: #F8CF44;
}
.menu:hover {
color: white;
}
p {
font-family: Verdana;
font-size: small;
color: white;
margin-top: 14px;
margin-left: 13px;
margin-right: 10px;
}
.img2 {
margin-right: 48px;
margin-top: 17px;
margin-left: 25px;
margin-bottom: 10px;
}
a {
text-decoration: none;
color: black;
}
.footer {
margin-left: 16px;
margin-bottom: 0;
color: black;
}
.footer2:hover {
color: white;
}
body {
font-family: Verdana, sans-serif;
margin: 0;
}
.row > .column {
padding: 0 8px;
}
.row:after {
content: "";
display: table;
clear: both;
}
.column {
float: left;
width: 25%;
}
.modal {
display:none;
position: fixed;
z-index: 1;
padding-top: 35px;
left: 407px;
top: 151px;
width: 687px;
height: 76%;
overflow: auto;
}
.modal-content {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
width: 90%;
max-width: 1200px;
animation-name: zoom;
animation-duration: 0.3s;
}
#caption {
margin: auto;
display: block;
width: 100%;
text-align: center;
color: #ccc;
padding: 6px 0;
background-color: rgba(9,9,9,9.9);
height:18px;
}
.prev:hover,
.next:hover {
background-color: rgba(0, 0, 0, 0.8);
}
.close {
color: white;
position: absolute;
top: -4px;
right: 33px;
font-size: 31px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #999;
text-decoration: none;
cursor: pointer;
}
.mySlides {
display: none;
}
.cursor {
cursor: pointer;
}
.prev,
.next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -50px;
color: white;
font-weight: bold;
font-size: 20px;
border-radius: 0 3px 3px 0;
user-select: none;
-webkit-user-select: none;
}
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
img {
margin-bottom: -4px;
}
.demo {
opacity: 0.6;
}
.active,
.demo:hover {
opacity: 1;
}
img.hover-shadow {
transition: 0.3s;
}
<center>
<table border="0" cellpadding="0" cellspacing="0" width="780" background="https://source.unsplash.com/user/erondu/100x200" width="374" valign="top" style="color:white; font-size: small; font-family:
Verdana;height:512px;background-position-x: right; background-size: 783px 1357px;">
<tr>
<td><img src="images\top.jpg" width="780" height="108"></td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="780">
<tr>
<td width="159" height="265" valign="top" background="images\extra.jpg">
<table class="table1" style="line-height: 197%;margin-left: 20px;margin-top: 0px;" border="0" cellpadding="0" cellspacing="0" align=left>
<tr>
<td><a class="menu" href="index.html">Home</a></td>
</tr>
<tr>
<td><a class="menu" href="vision.html">Vision </a></td>
</tr>
<tr>
<td><a class="menu" href="history.html">History</a></td>
</tr>
<tr>
<td><a class="menu" href="location.html">Location</a></td>
</tr>
<tr>
<td><a class="menu" href="organisation.html">Organisation</a></td>
</tr>
<tr>
<td><a class="menu" href="curriculum.html">Curriculum</a></td>
</tr>
<tr>
<td><a class="menu" href="school_uniform.html">School Uniform</a></td>
</tr>
<tr>
<td><a class="menu" href="teaching_staff.html">Teaching Staff</a></td>
</tr>
<tr>
<td><a class="menu" href="facilities.html">Facilities</a></td>
</tr>
<tr>
<td><a class="menu" href="activities.html">Activities</a></td>
</tr>
<tr>
<td><a class="menu" href="rules.html">Rules</a></td>
</tr>
<tr>
<td><a class="menu" href="register_online.html">Register online</a></td>
</tr>
<tr>
<td><a class="menu" href="photogallery.html">Photogallery</a></td>
</tr>
<tr>
<td><a class="menu" href="contact_us.html">Contact Us</a></td>
</tr>
<tr>
<td><a class="menu" href="site_map.html">Site Map</a></td>
</tr>
</table>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="621">
<tr>
<td><img border="0" src="images\photogallery_img.jpg" width="621" height="34"></td>
</tr>
<table border="0" cellpadding="0" cellspacing="0" width="581">
<tr>
<td colspan="2" align="center" height="30" style="font-size:14px; color:white;"><b>ANNUAL
FUNCTION<br>
<br>
</b></td>
</tr>
<tr>
<div class="row">
<div class="column">
<td>
<p align="center"><img src="https://source.unsplash.com/user/erondu/100x100" width="250" height="164" onclick="openModal();currentSlide(1)" class="hover-shadow cursor" >
</td>
</div>
<div class="column">
<td>
<p align="center"><img src="https://source.unsplash.com/user/erondu/100x200" width="250" height="164" onclick="openModal();currentSlide(2)" class="hover-shadow cursor">
</td>
</div>
</tr>
<tr>
<td colspan="2" height="20"></td>
</tr>
<tr>
<div class="column">
<td>
<p align="center"><img src="https://source.unsplash.com/user/erondu/100x250" width="250" height="164" onclick="openModal();currentSlide(3)" class="hover-shadow cursor">
</td>
<td>
</div>
<div class="column">
<p align="center"><img src="https://source.unsplash.com/user/erondu/100x100" width="250" height="164" onclick="openModal();currentSlide(4)" class="hover-shadow cursor">
</td>
</div>
</tr>
<div id="myModal" class="modal">
<span class="close cursor" onclick="closeModal()">×</span>
<div class="modal-content">
<div class="mySlides">
<img src="https://source.unsplash.com/user/erondu/100x100" style="width:100%">
<p id="caption" style="padding-bottom: 7px;font-size: 17px;">Annual function</p>
</div>
<div class="mySlides">
<img src="https://source.unsplash.com/user/erondu/100x200" style="width:100%">
<p id="caption" style="padding-bottom: 7px;font-size: 17px;">Annual function</p>
</div>
<div class="mySlides">
<img src=https://source.unsplash.com/user/erondu/100x250" style="width:100%">
<p id="caption" style="padding-bottom: 7px;font-size: 17px;">Annual function</p>
</div>
<div class="mySlides">
<img src="https://source.unsplash.com/user/erondu/100x100" style="width:100%">
<p id="caption" style="padding-bottom: 7px;font-size: 17px;">Annual function</p>
</div>
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
<div class="caption-container">
<p id="caption" ></p>
</div>
</div>
</div>
</div>
</table>
<tr>
<td colspan="3" width="780" background="images\bottom_img.jpg" height="27" style="font-size:x-small;
font-family: Verdana; font-weight: bold;"><b class="footer" style="margin-left: 18px;">Powered by <a href="http://www.catchal.net" target="_blank" class="footer2">Catchcal.net</a><b></td>
</tr>
</table>
</center>