php - 如何在 FancyBox 上使所有图像的纵横比为 1:1?
问题描述
我对 FancyBox v3 缩略图有疑问。我想要 1:1 纵横比的所有缩略图图像。在图库视图中,一切正常。我该如何解决这个问题?我需要改变什么价值?查看照片了解更多信息
Bootstrap 版本:5 PHP 版本:7.4 FancyBox 版本:3
HTML 代码
<!DOCTYPE html>
<html lang="it">
<head>
<title>Annuario | ProLab</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../../../../css_bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="../../../../css/index_style.css">
<!-- Fancybox CSS library -->
<link rel="stylesheet" href="/php/fancybox/jquery.fancybox.css">
<!-- Stylesheet file -->
<link rel="stylesheet" href="../../../styleGalleria.css">
<!-- jQuery library -->
<script src="../../../js/jquery.min.js"></script>
<!-- Fancybox JS library -->
<script src="../../../fancybox/jquery.fancybox.js"></script>
<!-- Initialize fancybox -->
<script>
$("[data-fancybox]").fancybox();
</script>
</head>
<body>
<div class="containerGriglia" id="screenshot">
<div class="rowGriglia">
<div class="galleria" id="screenshot">
<?php
require '../connessione_liceo_cavalieri.php';
$query = $db->query("SELECT * FROM 2ASU WHERE status = 1 ");
if ($query->num_rows > 0) {
while ($row = $query->fetch_assoc()) {
$imageThumbURL = 'img/' . $row["file_name"];
$imageURL = 'img/' . $row["file_name"];
$nome = '' . $row["nome"];
$cognome = '' . $row["cognome"];
?>
<a href="<?php echo $imageURL; ?>" data-fancybox="gallery" data-caption="<?php echo $row["title"]; ?>">
<img src="<?php echo $imageThumbURL; ?>" alt="">
<?php echo $nome; ?>
<?php echo $cognome; ?>
</a>
<?php }
} ?>
</div>
</div>
</div>
</div>
</div>
<script src="../../../../js_bootstrap/bootstrap.bundle.min.js"></script>
</body>
</html>
CSS 代码
.containerGriglia{
padding: -20px;
float: left;
width: 1000px;
height: 1000px;
}
.galleria a{
text-decoration: none;
padding: 5px;
float: left;
width: 20%;
}
.galleria img {
width:100%;
height: auto;
border-radius: 5px;
cursor: pointer;
transition: .3s;
}
.rowGriglia{
margin-right: 30px;
margin-left: 30px;
}
*{
margin:0;
padding:0;
}
谢谢大家的回复。
解决方案
推荐阅读
- react-i18next - react-i18next - 检测是否使用了后备语言
- javascript - Google Map Place API:自动完成选项和 place_changed 事件返回不同的区域名称
- firebase - 配置项目“:cloud_firestore”时出现问题 //已关闭
- ruby - Ruby-selenium 连接到远程 webdriver
- typescript - 禁止接口子级中的属性
- php - Laravel - 为什么我在访问给定页面后被阻止?
- java - 如何在Java中更改文件的路径名?
- laravel - Vuetify 图标不显示。它交替显示一个空框
- mysql - Mysql:如何检索当前日期的数据并减去 7 小时
- java - 如何跟踪应用程序启动