Answer the question
In order to leave comments, you need to log in
How to close pop up automatically after n seconds?
I'm trying to make it so that after submitting the contact form, a pop-up window appears with a notification of the success of the operation. The first part was executed with the following code:
function slug_post_form_submit( obj ) {
jQuery('#success-message').show();
}
<section id="success-message">
<div class="popup"> <h2>Успешно!</h2>
</div>
</div>
.popup {
position: absolute;
top: 27%;
left: 0;
right: 0;
width: 490px;
margin: auto;
height: 366px;
background: #fff;
}
#success-message {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.56);
z-index: 999!important;
background: rgba(40, 69, 113, 0.4);
}
#success-message {
display: none;
}
setTimeout(function() { $("#success-message").hide('slow'); }, 2000);
Answer the question
In order to leave comments, you need to log in
On both sites, horizontal scrolling appeared on a 1366x768 monitor. Didn't look further.
the first is good, but 2 points are confusing:
firstly, the hamburger menu in the desktop
; secondly, something is missing in the visual, like the "a lot of air and spots" style, but it somehow doesn't look... In short, a purely personal perception, without specifics, Alas.
Second - subjectively like it, but it is the lack of an adaptive that is a huge minus. Make at least a scale for the viewport ...
Everything is cool, I like it, only on mobile it was possible not to limit the width of the container so much) and fixed to adapt, good luck in development)
block how the classes are held in the mobile version, it would be better to make a slider (slick slider, etc.).
on the "fix" page I have horizontal scrolling on my hd monitor, but the design itself impressed me.
try in the head on the 2nd site add:
<meta name="viewport" content="width=device-width, initial-scale=1">
then horizontal scrolling may be gone
I opened it only on a mobile phone, the second one should be adapted. At first, I would remove the outline from the buttons. and here is the link to the picture
<body>
<section id="successMessage">
<div class="popup">
<h2>Успешно!</h2>
</div>
</section>
<script type="text/javascript" charset="utf-8">
setTimeout(() => successMessage.hidden = true, 2000)
</script>
</body>
// 1
jQuery('#success-message').show();
setTimeout(function(){ jQuery('#success-message').hide(); }, 3500);
// 2 этот не проверял, не могу сказать, будет ли работать
jQuery('#success-message').show(0).delay(1000).hide(0);
Have you already tried that?
jQuery('#success-message').show('normal', function() {
setTimeout(function() { jQuery("#success-message").hide('slow'); }, 2000);
});
Watch out for $ and jQuery at the start of requests. Older versions don't support the $("#div"). fadeOut(); format. , instead of jQuery(“#div”). fadeOut();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question