Skip to content

Commit

Permalink
Se elimina el tooltip del botón enviar y se agrega Popover y sus conf…
Browse files Browse the repository at this point in the history
…iguraciones para operar
  • Loading branch information
carlostoledoe committed Mar 12, 2024
1 parent 20274fd commit b17a041
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))

// Popover
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))

//Scroll Reveal
window.sr = ScrollReveal();
sr.reveal('#quienes-somos', {
Expand All @@ -25,4 +29,19 @@ window.addEventListener('scroll', function() {
} else {
navbar.classList.remove('navbar-color-change');
}
});

// Para prevenir que la página suba al presionar el botón
document.querySelector('.btn[data-bs-toggle="popover"]').addEventListener('click', function(e) {
e.preventDefault();
});

// Para oculpar popover luego de un tiempo
$(document).ready(function(){
$('[data-bs-toggle="popover"]').popover().on('shown.bs.popover', function(){
var _this = this;
setTimeout(function(){
$(_this).popover('hide');
}, 1600);
});
});
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ <h2 class="text-center mt-4">CONTACTO</h2>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
</div>
<div class="d-flex justify-content-right">
<button type="submit" class="btn btn-light px-4 mb-3" data-bs-toggle="tooltip" data-bs-placement="top"
data-bs-custom-class="custom-tooltip"
data-bs-title="Presiona para enviar a tu mensaje">Enviar</button>
<button type="submit" class="btn btn-light px-4 mb-3"
data-bs-toggle="popover"
data-bs-content="Mensaje enviado exitosamente">Enviar</button>
</div>
</form>
</div>
Expand Down

0 comments on commit b17a041

Please sign in to comment.