Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Defaulting to the top of a topic, not the webpage

Aloittaja Tiggy00, joulukuu 28, 2013, 05:37:29 IP

« edellinen - seuraava »

Tiggy00

Hi, does anyone know of a way to have SMF default to the top of a topic, and not to the top of the forum webpage when a new topic is posted or when you go into a topic.  I can set the page by default to go to the top of the topic board where it shows the topics, but short of retro actively modifying all topics after they are created, when I go into a topic, it goes to the top of the forum webpage.  For instance, if I click on this posting after it is created, my scroll bar is at the top of the page.  However, I want the page top to be where it would show:

"Simple Machines Community Forum » Customizing SMF » SMF Coding Discussion » Topic:  Defaulting to the top of a topic, not the webpage"

Is there a way to set this so it is a default and I don't have to retroactively do it?  Our forum is just getting going so I could do it manually now, but as it gets going, it will become too much work to maintain this practice. 

Any help would be greatly appreciated.  Thanks.

Arantor

Holder of controversial views, all of which my own.


Tiggy00

This is great, thanks.  However, perhaps I wasn't clear enough.  Whether I create a new topic, or click into an existing one, I'm looking for the "top" of my page that is showing to not be the actual top of the page, but instead, the title showing what section of the forum I am in.  In the case of this particular post, I would like the "top" of the page that is showing (understanding that there is more above it off of the page) to be:

"Simple Machines Community Forum » Customizing SMF » SMF Coding Discussion » Topic:  Defaulting to the top of a topic, not the webpage"

Arantor

Interesting. What you've just described is not the same as your original post. Nor is it possible to do in SMF properly anyway.
Holder of controversial views, all of which my own.


Tiggy00

In re-reading my original post, I'm pretty sure I did describe that, but if it is not possible, it's irrelevant either way.  Thanks for trying to help.   :)

Chen Zhen

Tiggy00,

  I'll give you something to work with but the container id that it indexes may be unique for custom themes.

This example will index the top of a topic in the default theme:

<script type="text/javascript">
window.onload = function () {document.getElementById("forumposts").scrollIntoView(true);}
</script>


If you use a portal you can create an html block and use that code. Hide the title+body of the block and set it to appear on all boards.
Your alternative (if you do not use a portal) is to add that to the appropriate template file.

My SMF Mods & Plug-Ins

WebDev

SMF support staff should be shaping a positive community experience & not provoking an argument or emotional reaction.

Arantor

Which will work just great, right up until the ussr chooses to go to the first unread post, the last post in a topic or to any specific post (since the navigation has links for all of these), which this will break.
Holder of controversial views, all of which my own.


emanuele

http://stackoverflow.com/questions/298503/how-can-you-check-for-a-hash-in-a-url-using-javascript
<script type="text/javascript">
window.onload = function () {
if (!window.location.hash)
document.getElementById("forumposts").scrollIntoView(true);
}
</script>


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Tiggy00

Thank you all for the advice.  I will try and report back on how it works.

Advertisement: