Disable Autoscroll?

thewebguys
User w
User w
Posts: 11
Joined: Tue Jun 08, 2021 12:34 pm

Disable Autoscroll?

Post by thewebguys »

Hi
A lot of our users are complaining about the auto scroll feature with the forum embedded on a wordpress page, as it always scrolls back to the top for example when click the back button. Is it possible to disable this feature? I tried setting various integers in the options page, but it always does the same. Can I remove some code from a file to disable this?
Thanks
Jon
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Disable Autoscroll?

Post by axew3 »

hi, the unique code that interact with this, is the one into page-forum.php
that is the file you have into your active template folder, named as the blank page you created (that so when you call the url, the page load).
Into this file, there is this code:

Code: Select all

      var w3all_lochash = /.*(#w3all_lochash)=([0-9]+).*/ig.exec(res);
      if(w3all_lochash !== null && w3all_lochash[2] != 0){ 
         jQuery('html, body').animate({ scrollTop: w3all_lochash[2]}, 400);
       } else {
         jQuery('html, body').animate({ scrollTop: ".$w3all_iframe_custom_top_gap."}, 400);
       }
the var w3all_lochash is sent back to the wp page-forum by the phpBB overall_footer.html code you added into phpBB when it is called into the wp page as an iframe:
by default, the scroll isset to w3all_lochash[2] value or $w3all_iframe_custom_top_gap.

$w3all_iframe_custom_top_gap is the value to set for the default position to scroll to, when w3all_lochash[2] is NOT 0

You can manually change these values or even remove and substitute the entire code.

400 is the value of the scroll speed

The whole iframe logic, the scroll and several iframe issues will be soon moved to the next step on next coming soon version

EDITED
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Disable Autoscroll?

Post by axew3 »

the above answer, that was wrong, as been updated
thewebguys
User w
User w
Posts: 11
Joined: Tue Jun 08, 2021 12:34 pm

Re: Disable Autoscroll?

Post by thewebguys »

Thank you very much :-)
Post Reply