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?
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.
[url=https://www.axew3.com/w3/2019/03/smooth-scroll-for-phpbb-wordpress-template-integration-iframe-v3/]The phpBB smooth scroll solution works fine[/url]. 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:
[b]on [i]overall_footer.html code[/i]:[/b]
where:
[code]if( /posting\.php\?mode=[reply|post|bump]/ig.exec(href) !== null || /mcp\.php\?/ig.exec(href) !== null ){
var w3allNOappend = true;
}[/code]
change into:
[code]if( /posting\.php\?mode=[reply|post|bump]/ig.exec(href) !== null || /mcp\.php\?/ig.exec(href) !== null ){
w3allappend = boardU;
}[/code]
now into your WP template [b]page-forum(orWhateverYouNamedIt).php[/b]
immediately after this line:
[code]history.pushState({w3all_passed_url: w3all_passed_url}, \"Forum\", w3all_passed_url_push);[/code]
ADD this code:
[code]jQuery( '#w3all_phpbb_iframe' ).on( \"load\", function() {
jQuery('html, body').animate({
scrollTop: jQuery('.site-content').offset().top
}, 0);
});[/code]
[b]NOTE that [i].site-content[/i] need to match the assigned class of the element that wrap the main WP page content.[/b]
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.
[b]Note[/b] that here, is not possible for what i tested out, to smooth scroll:
[code]jQuery('html, body').animate({
scrollTop: jQuery('.site-content').offset().top
}, 300);[/code]
will not work. The page when on #anchor links will scroll to top by the way.
Any solution?