Answer the question
In order to leave comments, you need to log in
Why does the page scroll up when I click on the popup button?
Good afternoon.
Created a modal window with a form, so far only layout.
Here is the form
<div class="popup-address" id="js-popup-address">
<a class="popup-address__close" href="#" id="js-popup-address__close"></a>
<div class="popup-address__content">
<div class="popup-address__form">
<div class="form-group">
<input type="text" name="nome" placeholder="Nome">
</div>
<div class="form-group">
<input type="text" name="cognome" placeholder="Cognome">
</div>
<div class="form-group">
<input type="email" name="email" placeholder="Email">
</div>
<div class="form-group">
<input type="tel" name="telefono" placeholder="Telefono">
</div>
<div class="form-group">
<textarea name="messaggio" placeholder="Messaggio"></textarea>
</div>
<div class="privacy">
<input id="check" type="checkbox" name="check">
<label for="check">Dichiaro di aver letto ed accettato l'informativa sulla privacy
<a href="/privacy/">(Leggi l'informativa)</a>
</label>
</div>
<input class="btn btn--transparent btn--block" type="submit" value="Invia Richiesta">
</div>
</div>
</div>
let popupAddress = function () {
$('.btn--popup-address').on('click', function (e) {
e.preventDefault();
$('body').addClass('body--fixed');
$('#js-overlay').fadeIn();
$('#js-popup-address').fadeIn();
});
$('#js-popup-address__close, #js-overlay').on('click', function (e) {
e.preventDefault();
$('body').removeClass('body--fixed');
$('#js-overlay').fadeOut();
$('#js-popup-address').fadeOut();
});
};
popupAddress();
html {
height: 100%;
}
body.body--fixed {
position: fixed;
top: 0;
left: 0;
height: 100%;
overflow: hidden;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question