'Back to top' feature

mishhh - February 23, 2007 - 19:43
Project:Table of Contents
Version:6.x-3.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:AlexisWilke
Status:closed
Description

I don't know how to remove the other duplicate feature request.

There would be of much help if in front of every h2 and h3 tags was a picture of some kind with a link "Back to top" or "Back to Table of contents". In this way, the user would go fast back and forth between the content and table of contents.

It will be a nice addition to this module. I love what this module does, and it would be of much help if an option would be added to provide this feature.

At present moment, I use the patched version of table of contents for drupal 5.0. The modification will be available for 5.0 version too?

#1

deviantintegral - February 24, 2007 - 23:02
Status:active» duplicate

Duplicate of #122064.

#2

deviantintegral - February 24, 2007 - 23:03
Status:duplicate» active

Edited wrong ticket...

#3

deviantintegral - February 24, 2007 - 23:13

I don't know how to remove the other duplicate feature request.

Done!

There would be of much help if in front of every h2 and h3 tags was a picture of some kind with a link "Back to top" or "Back to Table of contents".

That could be good. I would suppose that one should also be added to the very end of the page, with additional links inserted above each header. Would it make sense to make an option per page so that shorter pages wouldn't render the links?

At present moment, I use the patched version of table of contents for drupal 5.0. The modification will be available for 5.0 version too?

Yes. Within the next week or two hopefully I'll have the time to set up a 5.0 installation to develop against.

#4

mishhh - February 25, 2007 - 11:26

I guess putting "Back to top" links at the left of the headers would be nicer. Maybe i didn't understand what you mean by "additional links inserted above each header". But everywhere will do.

Anyway, It would be nice to have some checkboxes in the settings page to permit users to choose these links. Maybe some users would not want to put this "Back to top links"

And yes, one "Back to top" link should be placed at the end of the article too. it didn't cross my mind until you said it.

#5

deviantintegral - November 13, 2007 - 01:33
Version:4.7.x-1.0» 5.x-2.x-dev

#6

casey - December 11, 2007 - 13:19

This feature should be a seperate module I think.

#7

wayland76 - February 14, 2008 - 04:31

No, I think it should be an optional feature in this module.

It'd also be kinda cool if the headers were numbered with the same numbers as the ToC (again, as an option). It'd be even nicer if you could choose either the header numbering, or the ToC, or both.

#8

wayland76 - February 14, 2008 - 04:33

Oops, my comment is a duplicate of http://drupal.org/node/144595

#9

ipwa - August 19, 2008 - 21:57

I needed this feature, and I already was implementing jQuery on my page to use the LocalScroll plugin with my table of content, so I found that this can be done easily with a little jQuery:

$(document).ready(function() {

  $("h2, h3").after("<p class=\"top\"><a href=\"#header\">back to top</a></p>");
  //$('.toc-list > ol > ol > li, .top').localScroll( { hash : true } ); to apply LocalScroll (jquery update needed)  

});

Having a checkbox in the admin to activate LocalScroll and packaging it with the module would be really cool!

#10

deviantintegral - October 20, 2008 - 14:04

Here is a patch against the D5 version. It still needs settings to control what heading levels to add "Back to top" links, so I won't commit it or do a D6 patch until 296171: Change Defaults? lands.

It includes LocalScroll, and gracefully degrades if jquery_update isn't installed on Drupal 5. After this is committed, the README will need to be updated to indicate jquery_update as a useful module.

--Andrew

AttachmentSize
122064_back_to_top_10.patch 5.9 KB

#11

deviantintegral - October 20, 2008 - 14:04
Status:active» postponed

#12

nicholas.alipaz - October 29, 2008 - 09:36

Just wanted to say, I was looking for this too. It will be great!

I am on 6.6 for the record

#13

freatida - December 9, 2008 - 07:36

deviantintegral's patch works for me - thanks for that - but the "back to top" link appears in teaser lists. Just to let you know in case you want to change this before committing.

#14

nicholas.alipaz - December 10, 2008 - 09:43

yes, I have added the patch as well. works well, but like freatida said it shows in teasers as well as no configuration options for which header tags to show it on. That was mentioned previously as well.

#15

deviantintegral - December 10, 2008 - 16:26

Here is a very lightly tested patch which should respect *global* settings for inserting the back to top links. I discovered that while Zen and other Drupal themes include a CSS class for teasers, Garland doesn't, so I'm going to have to do it through hook_nodeapi(). I'm going to leave this as postponed until #191683: prevent toc from appearing in teaser lists is committed. If you're interested in this issue, please head over there and test the posted patches.

Thanks!

AttachmentSize
122064_back_to_top_15.patch 6.5 KB

#16

freatida - December 12, 2008 - 13:40

Haven't tested the latest patch yet, but I forgot to mention that along with specifying heading levels, there should also be an option to only show "back to top" link on nodes which have a table of contents. As it is, the back to top link is appearing on all headers, regardless.

#17

AlexisWilke - July 5, 2009 - 10:48
Status:postponed» active

I'll do a version of that for 3.x-dev and it will be in PHP. That way we can make sure it uses it only if the table of content is created.

Thank you.
Alexis Wilke

#18

AlexisWilke - July 6, 2009 - 00:21
Version:5.x-2.x-dev» 6.x-3.x-dev
Assigned to:Anonymous» AlexisWilke
Status:active» fixed

This is done in 3.x-dev. FYI, I'm not going to port that back to v5.x. It is time for you to move forward anyway!

Thank you.
Alexis Wilke

#19

nicholas.alipaz - July 6, 2009 - 17:09

Thanks for the addition in the latest alexis. I will be testing for sure. I will post back if there are any issues.

#20

ipwa - July 6, 2009 - 17:38

Hey Alexis, I'm glad this feature got committed, and yeah much better to do it in php, because it'll work with JS disabled. I mentioned it might be nice to have LocalScroll as an option included with this module and deviantintegral's patch included LocalScroll, is this a feature you are still considering?

#21

AlexisWilke - July 6, 2009 - 19:08
Status:fixed» active

ipwa,

Ah! I did not notice the local scroll feature. Does that make the screen scroll back to the top with jQuery?

It could be neat, but I'll put a flag to turn the feature ON or OFF because for large pages it could be real slow.

Thank you.
Alexis

#22

nicholas.alipaz - July 6, 2009 - 19:22

Alexis,

Thanks again for your work on this, just thought I would chime in to say what localscroll does. It does anchor navigation using jQuery animation.
http://demos.flesler.com/jquery/localScroll/

It is a nice feature and I would be interested in it too.
--
Nicholas

#23

AlexisWilke - July 6, 2009 - 20:20

Nicholas,

Thank you for the link! Nice demo! That's a crazy feature! Definitively need to have a flag to turn it off!!!

Alexis

#24

AlexisWilke - July 19, 2009 - 08:21
Status:active» fixed

Okay. That's done. Let me know if you have a problem and reactivate this issue if so.

Thank you.
Alexis Wilke

#25

ipwa - July 22, 2009 - 00:15

This is an example of how I implemented LocalScroll with table of content: http://forestry.spring-php.com/about/grant

I did this when I posted my first comment of the thread: http://drupal.org/node/122064#comment-971086

#26

AlexisWilke - July 22, 2009 - 00:21
Status:fixed» active

So what you're saying is that what I have now does not satisfy you?

I would think it would be easy to get the back to top right after the header and/or at the end of a paragraph (before the next header)

And it seemed logical to go back to the existing TOC instead of some random #<name> since we cannot be sure it will be present in all themes. However, we could offer the user a way to enter the name of the anchor to use in their back to top link. Then you could use #header as you do now.

Is the numbering from v1.3? 8-)

Thank you.
Alexis Wilke

#27

AlexisWilke - July 22, 2009 - 09:06
Status:active» fixed

Okay, I did another update to you can set where you want the back to top links (i.e. right after the headers or after the paragraph.)

Let me know if that works for you.

You'll have to tweak your CSS, eventually, so it looks better for your theme.

Thank you.
Alexis Wilke

#28

ipwa - July 23, 2009 - 06:53

So what you're saying is that what I have now does not satisfy you?

Not at all, I really appreciate you are maintaining this module, thanks for your contributions :)

I just wanted to show an example of this module working with LocalScroll.

Thank you!

Nicolas

#29

ipwa - July 23, 2009 - 06:53

Oh and sorry for commenting in a fixed issue :p

#30

AlexisWilke - July 23, 2009 - 09:01

ipwa,

Okay. I now added the support of the anchor. So you can enter "header" in the setup to go back to the top of the screen instead of the top of the TOC. Let me know if you are still missing something. 8-)

Thank you.
Alexis Wilke

#31

System Message - August 6, 2009 - 09:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.