Just another way to scroll the iframe - preparing v4 - advanced questions and solutions hints

Developing and fixes
User avatar
axew3
w3all User
w3all User
Posts: 2876
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Just another way to scroll the iframe - preparing v4 - advanced questions and solutions hints

Post by axew3 »

Preparing v4 code ...

Really SO Hard to explain the concept for me, but i will try, also searching for hints by cool guys.
This is another solution about how to workaround to the phpBB scroll, that should be correctly presented after the onlick action into any iframe link.
The phpBB smooth scroll solution works fine. But it scroll BEFORE the page load.

How to scroll, AFTER iframe loads?
The solution is simple for all events, except one that i've test:
when the link contain #anchor that make phpBB scroll down to the last post on topic (if order is descendant x example), then what i have not find the way to resolve easily, is that this event, make scroll to top the page anyway to top.
But the post on bottom should be presented instead.
I really have try out any possibility in mind to resolve with smooth scroll and get the right result, but i've fail until now.

So, the problem was (and still remain as it's origin) this:
how to scroll AFTER iframe loaded, to correct position?
At moment on this online example, the solution applied to the v3 iframe code and to get the AFTER re-position is this:

on overall_footer.html code:
where:

Code: Select all

if( /posting\.php\?mode=[reply|post|bump]/ig.exec(href) !== null || /mcp\.php\?/ig.exec(href) !== null ){
var w3allNOappend = true;
}
change into:

Code: Select all

if( /posting\.php\?mode=[reply|post|bump]/ig.exec(href) !== null || /mcp\.php\?/ig.exec(href) !== null ){
w3allappend = boardU;
}
now into your WP template page-forum(orWhateverYouNamedIt).php
immediately after this line:

Code: Select all

history.pushState({w3all_passed_url: w3all_passed_url}, \"Forum\", w3all_passed_url_push);
ADD this code:

Code: Select all

jQuery( '#w3all_phpbb_iframe' ).on( \"load\", function() {
jQuery('html, body').animate({
    scrollTop: jQuery('.site-content').offset().top
 }, 0);
});
NOTE that .site-content need to match the assigned class of the element that wrap the main WP page content.
That is. The page reposition AFTER iframe loads to correct position, the unique time that it isn't in this way as i experience at time of this post, is when you go to (for example) execute a sticky action (the popup display on top).
I will check how to work around this.

Note that here, is not possible for what i tested out, to smooth scroll:

Code: Select all

jQuery('html, body').animate({
    scrollTop: jQuery('.site-content').offset().top
 }, 300);
will not work. The page when on #anchor links will scroll to top by the way.
Any solution?
User avatar
axew3
w3all User
w3all User
Posts: 2876
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Just another way to scroll the iframe - preparing v4 - advanced questions and solutions hints

Post by axew3 »

resolved: all answer perfect after a further change, so the v4 code will be released soon as it is now working on this online example.
It scroll ever to right position, AFTER phpBB iframe reload positioning to requested post.
The solution works perfect on any test, and return correct results in any case, even with users preferences changed to display Ascendant or Descendant. Unfortunately it is not smooth, but may it is better because a smooth scroll could exists already into many WP themes.
So this is perfect as is to work on any scenario. See you soon with v4 code ... Cheers to all cool people!
zawin

Re: Just another way to scroll the iframe - preparing v4 - advanced questions and solutions hints

Post by zawin »

Hello axew3,
it is possible to speed-up forum loading inside iframe? This loading is a little annoying. I 'm afraid it may discourage forum visitors.

Thank you
User avatar
axew3
w3all User
w3all User
Posts: 2876
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Just another way to scroll the iframe - preparing v4 - advanced questions and solutions hints

Post by axew3 »

Hi again, well, it is very fast into a fast server!
It is maybe not ever fast at shared axew3.com server :cry: ... i will move as i can axew3.com to a faster dedicated server.

Also, after all, the wordpress forum page need to load one time with his iframe, then when iframe loaded, the navigation on forum result to be exactly the same, like if you are at real phpBB url.
The problem at first time you open wp page-forum, is that wordpress load, and phpBB, separately, also load into the iframe.
A faster server will resolve any problem about this!

You could use a cache wp plugin to speed up things: but if using something like a wp cache plugin, than may exclude the page-forum to be cached, or test well things, looking if all work as needed when you login/out users in the iframed forum wp page.
zawin

Re: Just another way to scroll the iframe - preparing v4 - advanced questions and solutions hints

Post by zawin »

axew3, thanks for your instant reply :)
It is possible to disable loading animation?
I think it will be better if forum page will be displayed after full load.
Post Reply