yusm 6 months ago
parent
commit
f083374ca5

+ 40 - 38
fhKeeper/formulahousekeeper/webttkuaiban/src/main/resources/templates/knowledgeDetails.ftl

@@ -149,10 +149,50 @@
 <script src="/js/iframe.js"></script>
 
 <script>
+
+  $(document).ready(function() {
+    const images = $('#hypertextContent img');
+
+    images.on('click', function() {
+      currentImageIndex = images.index(this); 
+      $('#modalImage').attr('src', $(this).attr('src'));
+      $('#imageModal').fadeIn();
+      updateButtons();
+    });
+
+    $('#prevBtn').on('click', function() {
+      if (currentImageIndex > 0) {
+        currentImageIndex--;
+        $('#modalImage').attr('src', $(images[currentImageIndex]).attr('src'));
+        updateButtons();
+      }
+    });
+
+    $('#nextBtn').on('click', function() {
+      if (currentImageIndex < images.length - 1) {
+        currentImageIndex++;
+        $('#modalImage').attr('src', $(images[currentImageIndex]).attr('src'));
+        updateButtons();
+      }
+    });
+
+    function updateButtons() {
+      $('#prevBtn').prop('disabled', currentImageIndex === 0);
+      $('#nextBtn').prop('disabled', currentImageIndex === images.length - 1);
+    }
+
+    $('#modalLayout').on('click', function(event) {
+      if ($(event.target).is('#modalLayout')) {
+        $('#imageModal').fadeOut();
+      }
+    });
+  });
+  
   const knowledgeDetails = '/articleTemplate/articleDetail'
   function toKnowledge() {
     window.location.href = `/articleTemplate/pageList?pageIndex=1&pageSize=10`
   }
+  
   $('#returnIcon').click(function () {
     window.history.back()
   })
@@ -207,43 +247,5 @@
       }
   }
   reinitIframe()
-
-  $(document).ready(function() {
-    const images = $('#hypertextContent img');
-
-    images.on('click', function() {
-      currentImageIndex = images.index(this); 
-      $('#modalImage').attr('src', $(this).attr('src'));
-      $('#imageModal').fadeIn();
-      updateButtons();
-    });
-
-    $('#prevBtn').on('click', function() {
-      if (currentImageIndex > 0) {
-        currentImageIndex--;
-        $('#modalImage').attr('src', $(images[currentImageIndex]).attr('src'));
-        updateButtons();
-      }
-    });
-
-    $('#nextBtn').on('click', function() {
-      if (currentImageIndex < images.length - 1) {
-        currentImageIndex++;
-        $('#modalImage').attr('src', $(images[currentImageIndex]).attr('src'));
-        updateButtons();
-      }
-    });
-
-    function updateButtons() {
-      $('#prevBtn').prop('disabled', currentImageIndex === 0);
-      $('#nextBtn').prop('disabled', currentImageIndex === images.length - 1);
-    }
-
-    $('#modalLayout').on('click', function(event) {
-      if ($(event.target).is('#modalLayout')) {
-        $('#imageModal').fadeOut();
-      }
-    });
-  });
 </script>
 </html>