Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Go to ID button scroll effect

Featured Replies

Hi,

I have created a floating button that scrolls down to the #welcome section of my homepage when clicked.

How can I make the scroll smooth rather than just appearing at that section? I have tried the following property: 

scroll-behaviour: smooth;

 

Thanks in advance :-)

Can you dump your entire code here? I'll take a look at that for you. 

Based upon your description I'm not fully sure what you are trying to achieve, but I am struggling to understand why you would want to make a user click twice to interact with a button? That'd annoy the hell outta me, personally. 

  • Author

You don't need to click the button twice. I meant when you click the button the page will scroll to the #welcome section. It is working correctly, I would just like the page to scroll smoother.

Um, jQuery is all I sort of know;

$(document).ready(function(){
	$(".slideto").click(function(event) {
		event.preventDefault();
		var wh = $(this).attr("href");
		var trimmed = wh.substring(1);
		$("html, body").animate({ scrollTop: $(wh).offset().top - 20}, 1000, function(){ $(wh).focus(); });
	});
});

just add the class slideto on the link :)

Edited by BrowserBugs

  • Author
16 hours ago, BrowserBugs said:

Um, jQuery is all I sort of know;


$(document).ready(function(){
	$(".slideto").click(function(event) {
		event.preventDefault();
		var wh = $(this).attr("href");
		var trimmed = wh.substring(1);
		$("html, body").animate({ scrollTop: $(wh).offset().top - 20}, 1000, function(){ $(wh).focus(); });
	});
});

just add the class slideto on the link :)

Thank you, this worked :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.