Commit 30752b57 authored by Traboulsi's avatar Traboulsi
Browse files

Update public/js/add_content.js

No related merge requests found
Pipeline #9014 passed with stage
in 10 seconds
Showing with 4 additions and 10 deletions
+4 -10
......@@ -79,15 +79,8 @@ function addcontent(item) {
var sdgProjectLink = item.sdgImage;
var customColor = '#8A2BE2';
sdgProjectHTML = `<a class="sdg-button btn btn-sm btn-outline-" style="color: ${customColor}; border-color: ${customColor};"
href="javascript:void(0);"
onclick="toggleImage('${sdgProjectLink}'); changeColor(this, 'lilac');"
onmouseover="hoverEffect(this, 'white', 'lilac');"
onmouseout="hoverEffect(this, '${customColor}', 'white');">
SDG Projekt
<img id="sdgImage" src="" alt="SDG Project Image" style="max-width: 100%; max-height: 100%; display: none;">
</a> &nbsp;`;
}
sdgProjectHTML = `<a class="sdg-button btn btn-sm btn-outline-" style="color: white; border-color: ${customColor};" href="javascript:void(0);"onclick="toggleImage('${sdgProjectLink}'); changeColor(this, '${customColor}');" onmouseover="hoverEffect(this, 'lilac', 'white');"onmouseout="hoverEffect(this, '${customColor}', 'white');">SDG Projekt <img id="sdgImage" src="" alt="SDG Project Image" style="max-width: 100%; max-height: 100%; display: none;"></a> &nbsp;`;
}
/* var sdgProjectHTML = '';
......@@ -214,11 +207,12 @@ function addTeam(item) {
}
}
function toggleImage(imageLink) {
function toggleImage(imageLink, element) {
var imageElement = document.getElementById('sdgImage');
if (imageElement.src === imageLink) {
imageElement.src = '';
imageElement.alt = '';
element.style.backgroundColor = ''; // Reset background color on image hide
} else {
imageElement.src = imageLink;
imageElement.alt = 'SDG Project Image';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment