Reset HTML Frame scroll position


#1

Hi Group - I have several HTML Frames in “popup” boxes. When someone closes the popup to move onto something else, I need a way to reset those HTML Frames to scroll back to the top for the next time they are opened. I haven’t been able to figure this out yet. Any ideas? Thanks!


#2

Hello Matt,

There is no action that allows to do it “as is” but there is a quick trick to achieve that:

  • put the value of the html property for your HTML Frame Asset in a Text Asset, outside of the scene
  • bind the HTML Frame Asset html property to the text property of your Text Asset
  • on the trigger that will hide the HTML Frame Asset launch these actions:
    • hide the HTML Frame Asset (obviously)
    • with a small delay, (in order to not be visible, let’s use 1second) set the HTML Frame Asset html property to empty
    • with a small delay, (let’s use 1.1 second) set the HTML Frame Asset html property to the value of the text property of your Text Asset

Now, if you hide then show the HTML Frame Asset, it will always be displayed at top of the content.

I made another “quick n’dirty” sample, feel free to test and dig in.
Community-IframeTrick.zip (1.9 MB)

Regards,

Alex.


#3

Thanks, Alex! This worked brilliantly!