-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a scroll back to top button #216
Create a scroll back to top button #216
Conversation
Created a scroll back to top button.
Hi @SamarthShukla17 thanks for this contribution! I think the approach here needs a little adjustment. For the actual button the more appropriate element would be an anchor As for making the button appear after the user has scrolled a certain degree down the page, the amount of scroll needs to be long enough that the button would only appear on longer pages, and any javascript doing this would need to be within a separate |
This comment was marked as outdated.
This comment was marked as outdated.
I have created a scroll back to top button and an additional js for the same has been created.
@possumbilities I have created it using anchor tag, but could not create a new .js file as while running it could not initialize the file correctly. I'm updating the PR so review it once, and provide your feedback.❤️ |
Made the code more efficient.
And, now the scroll to top button only appears after scrolling 1000px. |
Updated the JS code for the scroll to top to make it more effective.
@possumbilities, @TimidRobot and @annatuma I have updated the JavaScript of the scroll to just define a certain scroll to make the scroll back to top button appear, i.e., 1000 px and have created an anchor tag in html and linked it with the top of the page to completely remove any requirement of extra JavaScript. This makes the code more concise and apt. Kindly review it and provide feedback if any further changes are required. Thanks❤️❤️. |
Created a separate JS file for the scroll behavior.
Hey @possumbilities, I have created a separate file for JS, removing any requirement for the href"#" and also added a smooth behaviour on scroll. |
Added the required end of the files and also fixed the document indentation of css file.
@SamarthShukla17 please resolve conflicts |
Resolved the conflicts. |
docs/scroll.js
Outdated
@@ -0,0 +1,11 @@ | |||
document.addEventListener("DOMContentLoaded", function() { | |||
let stt = document.getElementById("stt"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the element in question is changed to only have a class, you'd need to use a querySelector to grab it by class here, but if not then disregard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/index.html
Outdated
|
||
<h2 style="text-align: center; "><a href="/all">See all</a></h2> | ||
|
||
<a href="#the-top" class="stt" id="stt" title="scroll to top">Back To Top</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd opt for a class here, rather than an id. We don't need both. If there's good cause for the id instead, I'm open to it, but its redundant to have both.
I'd also suggest it be spelled out to be more semantic and descriptive.
So rather than a class or id of: stt
, it would be better as scroll-to-top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@SamarthShukla17 I added two minor comments. That should be the remainder of adjustments. I'll give this a small window to make those adjustments before moving to Approval. |
Removed id tag, as only class will do the work, changed the class name and replaced getElementById with querySelector.
…thShukla17/cc-resource-archive into Created_scroll_back_to_Top
Resolved the remainder of adjustments as required.❤️❤️ |
docs/_layouts/listing.html
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SamarthShukla17 I think you've accidentally added a bunch of html here you didn't mean to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I'm sorry about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted the changes in the commit, kindly review.
…om/SamarthShukla17/cc-resource-archive into Created_scroll_back_to_Top" This reverts commit 58564a7, reversing changes made to 3d2e4fc.
…com/SamarthShukla17/cc-resource-archive into Created_scroll_back_to_Top" This reverts commit 99fdc08.
…/github.com/SamarthShukla17/cc-resource-archive into Created_scroll_back_to_Top"" This reverts commit b48429f.
@SamarthShukla17 It looks like you've reverted a number of changes in the repository and now there's 133 files showing as affected in some way. |
@SamarthShukla17 Hi! are you intending to come back and clean up these last few commits? (if not, I'm going to close this PR) |
@SamarthShukla17 pinging you here again, before I close this. |
Hey, I am really sorry for not being able to respond and resolve the issue, I'll try my best to complete the required task. |
Closing this and moving the area of focus to Vocabulary. |
Fixes
Description
This Fix, resolves the issue of adding a scroll back to top button on the cc resource archive page.
Screenshots
Checklist
Update index.md
).main
ormaster
).visible errors.
Developer Certificate of Origin
For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."
Developer Certificate of Origin