1
Good morning friends,
I’ve been searching for days for a "page up" function, when the user clicks a button.
Only find options "add Back to Top button", but I do not want to add a button, I want the button to make the page go up. Type "select", and when the user selects the page goes up.
Someone knows that kind of function and can point me to some material?
I was trying to do it this way. haha
$document(onclick)function(){
$("[name='Selecionar']");
window.scrollTo({
top: 1000,
behavior: "smooth"
});
Now:
<script>
$(document).ready(function() {
$('.list_options.hotels .hotel_block .rooms_options > .price').click(function(event) {
event.preventDefault();
$('html, body').animate({scrollTop: 0}, 1000);
event.stopPropagation();
});
});
</script>
I don’t understand your problem. What differentiates "top page" of "top"? Is there an example or website that does this to show us?
– fernandosavio
Actually I don’t want to add a "back to top" button. I have several "select" buttons and I need the page to go up when he clicks one of these.
– Gabriel Salomão
Then it would be like "top", only instead of the page going up to the top it goes up to a specific element?
– fernandosavio
No, no. I’m sorry... I’ll send you the website link and you’ll see the select buttons. Today they go green when clicked, but I would like the page to go up when the customer clicked on them. https://bit.ly/2okGReI Climb to the top in case.
– Gabriel Salomão
You want, by clicking "select", page to go up to the top. But that’s exactly a back-up button. It’s still confusing. It seems to me that adding one
href="#algum-elemento"
would solve your problem– fernandosavio
So... the big problem is I don’t have access to HTML.
– Gabriel Salomão
Have you tried
window.scrollTo(0, 0)
?– fernandosavio
If you don’t have access to HTML vc at least you have access to JS files, or is it possible to include some JS in your site? From what I noticed all btns Sleciona has class="Purchase", so Bast vc include on your page a Script that picks up when some element with class="Purchase" is clicked the page scrolls to the top. But for that you will have to at least include a script on the page. I’ve noticed that your page has jQuery, it makes it even easier...
– hugocsl
Yes! I do have how to add JS in WP. Would that be the function that the above brother quoted? window.scrollTo(0,0) ?
– Gabriel Salomão