Commit ee5add98 authored by Cátia Kitahara's avatar Cátia Kitahara
Browse files

generaliza o js das modais

parent 7188cb7e
......@@ -42,15 +42,11 @@ document.addEventListener("DOMContentLoaded", function () {
};
}
cientistaMenu = document.getElementById('cientista-menu');
indice = document.getElementById('indice');
if (cientistaMenu){
cientista_menu_height = cientistaMenu.offsetHeight;
document.getElementById('capa').style.marginTop = '-' + cientista_menu_height + 'px';
var cientistaModal = document.getElementById('cc-cientista-modal')
cientistaModal.addEventListener('show.bs.modal', function (event) {
if (indice){
var itemModal = document.getElementById('cc-item-modal')
itemModal.addEventListener('show.bs.modal', function (event) {
// Button that triggered the modal
var trigger = event.relatedTarget
// Extract info from data-bs-* attributes
......@@ -60,12 +56,13 @@ document.addEventListener("DOMContentLoaded", function () {
// and then do the updating in a callback.
//
// Update the modal's content.
var modalTitle = cientistaModal.querySelector('.modal-header h4')
var modalBody = cientistaModal.querySelector('.modal-body')
var modalTitle = itemModal.querySelector('.modal-header h4')
var modalBody = itemModal.querySelector('.modal-body')
modalTitle.textContent = trigger.textContent
modalBody.innerHTML = document.getElementById(content).querySelector('.wp-block-group').innerHTML
})
modalBody.innerHTML = document.getElementById(content).innerHTML
});
}
......
Markdown is supported
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