CJ 1 년 전
부모
커밋
f4a88e616e
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      templates/blog.html

+ 9 - 1
templates/blog.html

@@ -184,7 +184,6 @@
                 <div class="content">{{ article.title }}</div>
                 <div class="content">{{ article.title }}</div>
             </h2>
             </h2>
             {% autoescape off %}
             {% autoescape off %}
-
                 {{ article.html_text }}
                 {{ article.html_text }}
             {% endautoescape %}
             {% endautoescape %}
 
 
@@ -229,6 +228,15 @@
 
 
         $(".ui.dropdown").dropdown();
         $(".ui.dropdown").dropdown();
     });
     });
+    let imgs = $('#article').find('p>img')
+
+    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(',')[0]}" data-magnify="gallery" data-src="${src}"  src="${src}"  data-href="${src}" "/></a>`)
+        }
+    }
     var lightbox = new PhotoSwipeLightbox({
     var lightbox = new PhotoSwipeLightbox({
         gallery: 'p',
         gallery: 'p',
         children: 'a',
         children: 'a',