有没有办法在PhotoSwipe 4?
中修改字幕字体和大小我没有运气地查看了CSS。我也尝试了一个没有运气的span标签。我也查看了javascript。
答案 0 :(得分:1)
我会单独保留default.css。
然后在您自己的样式表中添加标题字体的样式。
为什么?
看看default.css是否已更新,您需要再次更改它,如果您将样式与default.css文件分开,则可以避免以后在更新时不得篡改它。
查看此CodePen http://codepen.io/dimsemenov/pen/ZYbPJM的标记,您可以执行以下操作:
HTML
<div class="my-gallery" itemscope itemtype="http://schema.org/ImageGallery">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="img/dektop/1.jpg" itemprop="contentUrl" data-size="1200x1202">
<img src="img/thumb/1.jpg" itemprop="thumbnail" alt="Image description" />
</a>
<figcaption itemprop="caption img-description">
<div class="index">
<div class="img-title">
Title of the image or photo
</div>
<div class="img-year">
2003
</div>
<div class="dimensions">
1200 x 900 cm
</div>
<div class="technique">
Oil on cotton
</div>
</div>
</figcaption>
</figure>
然后将标题中的类设置为如下样式:
CSS
@media screen and (min-width:0px) {
.img-title {
font-size: 2em;
}
.img-year {
font-size: 1.2em;
}
.dimensions {
font-size: 1em;
}
.technique {
font-size: 0.8em;
}
}
@media screen and (min-width:320px) {
.img-title {
font-size: 4em;
}
.img-year {
font-size: 2.2em;
}
.dimensions {
font-size: 1.5em;
}
.technique {
font-size: 1.1em;
}
}
请记住包含所有JS和CSS文件,如下所示: http://photoswipe.com/documentation/getting-started.html
<!-- Core CSS file -->
<link rel="stylesheet" href="path/to/photoswipe.css">
<!-- Skin CSS file (styling of UI - buttons, caption, etc.)
In the folder of skin CSS file there are also:
- .png and .svg icons sprite,
- preloader.gif (for browsers that do not support CSS animations) -->
<link rel="stylesheet" href="path/to/default-skin/default-skin.css">
<!-- Core JS file -->
<script src="path/to/photoswipe.min.js"></script>
<!-- UI JS file -->
<script src="path/to/photoswipe-ui-default.min.js"></script>
参考: Responsive PhotoSwipe with large controls on mobile device