Posting a message from a Child page to its parent

Do you want to share WYSIWYG Web Builder tips, tricks, tutorials or useful HTML code? You can post it here...
(no questions or problems please, this section is not monitored by support).
Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.

PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
Post Reply
User avatar
alex4orly
 
 
Posts: 986
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Posting a message from a Child page to its parent

Post by alex4orly » Sun Aug 14, 2016 7:53 am

Hello all,

I have a page here - this is the PARENT page : http://www.beleuramyhome.org.au/videoclips.html
It has a Layout grid with 2 columns
In the RHS column is an iFrame, The iFrame loads into itself a CHILD page which has in it a Blog Object
The Blog object has in it many entries, and the visitor scrolls down to click on a button, by that time - the Viewer which resides in the LHS of the PARENT page is already out of sight.
I want to force the click to execute 2 things onto the PARENT page
1) Make the link of the new video clip into the viewer, AND
2) Force the PARENT page to scroll back into view top of page
This can be better seen on a mobile phone - where the problem manifest itself

I have seen some suggestion of using a windows=>postmessage from the click in the blog into the PARENT but have no idea how to go about it

Hope somebody here can help me
Thanks

User avatar
BaconFries
 
 
Posts: 4906
Joined: Thu Aug 16, 2007 7:32 pm

Re: Posting a message from a Child page to its parent

Post by BaconFries » Sun Aug 14, 2016 10:20 am

Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.

User avatar
alex4orly
 
 
Posts: 986
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Posting a message from a Child page to its parent

Post by alex4orly » Mon Aug 15, 2016 12:52 am

BaconFries wrote:Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.
OOPS... unintentional, didn't notice into which forum I am posting.
BUT - to pay for my Sin, I RESOLVED this as follows, and offer to share it as my trick contribution

In the CHILD page, where the Blog object is:
Open the Events tab, click Add and Add 2 events. For both - chose OnClick, for both chose Java Script
In this order - insert
1) window.parent.scrollTo(0, 0);
2) return true;

Upon clicking the selected Blog option, it loads the respective URL into the viewer, and scrolls the browser back to the top of the page... Easy... (after I found a hint at w3schools.com)

Hope some else can find this useful

Post Reply