Answer the question
In order to leave comments, you need to log in
How to combine two scripts into one (window close and scroll up)?
Hello.
There is a script that closes a certain div block after selecting any option in the select.
But the problem is that on the mobile version, when selecting select, the screen goes down a little, how to combine the scroll and close script in one action?
Script to close div when option is selected:
<script>
jQuery(document).ready(function() {
jQuery("#block").change(function() {
if(jQuery(this).find("option:selected").val()) {
jQuery(".block-main").addClass('block_open');
}
});
});
</script>
$('html, body').animate({scrollTop: 0}, 1000);
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