|
@@ -115,15 +115,6 @@
|
|
|
font-weight: 300;
|
|
|
}
|
|
|
|
|
|
- p > a > img {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
-
|
|
|
- p > img {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
|
|
|
.pre {
|
|
|
background-color: antiquewhite;
|
|
@@ -250,11 +241,24 @@
|
|
|
});
|
|
|
let imgs = $('#article').find('p>img')
|
|
|
|
|
|
+ function getClass(width) {
|
|
|
+ if (width > 35 && width < 150) {
|
|
|
+ return 'ui small rounded image'
|
|
|
+ } else if (width > 150 && width < 600) {
|
|
|
+ return 'ui medium rounded image'
|
|
|
+ } else if (width > 600) {
|
|
|
+ return 'ui fluid rounded image'
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for (let i = 0; i < imgs.length; i++) {
|
|
|
if ($(imgs[i]).attr('alt')) {
|
|
|
let alt = $(imgs[i]).attr('alt')
|
|
|
let src = $(imgs[i]).attr('src')
|
|
|
- $(imgs[i]).parent().html(`<a data-pswp-width="${alt.split(',')[0]}" data-pswp-height="${alt.split(',')[1]}" href="${src}"><img width="${alt.split(',')[0]}" height="${alt.split(',')[1]}" data-magnify="gallery" data-src="${src}" src="${src}" data-href="${src}" "/></a>`)
|
|
|
+ $(imgs[i]).parent().html(`<a data-pswp-width="${alt.split(',')[0]}" data-pswp-height="${alt.split(',')[1]}" href="${src}"><img class="${getClass(alt.split(',')[0])}" width="${alt.split(',')[0]}" height="${alt.split(',')[1]}" data-magnify="gallery" data-src="${src}" src="${src}" data-href="${src}" "/></a>`)
|
|
|
+ } else {
|
|
|
+ let src = $(imgs[i]).attr('src')
|
|
|
+ $(imgs[i]).parent().html(`<img class="ui fluid rounded image" src="${src}" />`)
|
|
|
}
|
|
|
}
|
|
|
var lightbox = new PhotoSwipeLightbox({
|