How do I fix this? Whenever I choose an option and the text on the next screen is too long... (Gamebook) [Solved]

karinchan999
28 May 2018, 15:54

For all those who helped me with my previous problem, thank you very much. You guys are very patient with me. But as I finish the introduction of the game and now on chapter 1's first quest, I noticed a problem as I check it from time to time. See problem below...

Whenever I choose an option and it leads me to the next page where there's a lot of text, the screen immediately scrolls down to the end of it, skipping the first half.

For example, I'm in Page1 and when I choose from the options, let's say I choose Page2 and it leads me to Page2.
Now Page2 contains lots of paragraphs that it requires to scroll up and down to be able to read everything.

The problem is that, whenever I arrive to Page with long text, the screen automatically scrolls down to the bottom, skipping the top. I have to put effort in scrolling up in all pages.

How do I fix this?
I am a beginner, please help me.

Thank you in advance!


K.V.
28 May 2018, 17:56

Add this line to your "script when entering page" on the game object:

JS.eval ("if (typeof(scrollingSetup) == 'undefined'){ var scrollingSetup = true; function scrollToEnd() {     var scrollTo = _animateScroll ? beginningOfCurrentTurnScrollPosition - 50 - $(\"#gamePanelSpacer\").height() : $(document).height();     var currentScrollTop = Math.max($(\"body\").scrollTop(), $(\"html\").scrollTop());     if (scrollTo > currentScrollTop) {         var maxScrollTop = $(document).height() - $(window).height();         if (scrollTo > maxScrollTop) scrollTo = maxScrollTop;         var distance = scrollTo - currentScrollTop;         var duration = _animateScroll ? distance / 0.4 : 1;     if (duration>2000) duration=2000;         $(\"body,html\").stop().animate({ scrollTop: scrollTo }, duration, \"easeInOutCubic\");     }     $(\"#txtCommand\").focus();} }")

karinchan999
29 May 2018, 04:50

Thank you thank you thank you very much!
You are a big help K.V.! Thank you!
It works and every time I enter a new page with long content it doesn't start at the bottom, thank you!


K.V.
29 May 2018, 05:09

Yay!

(I just learned how to do that the other day, but don't tell anybody else.)


CheeseMyBaby
29 May 2018, 06:15

Was looking for something like this!
Thanks K.V.!!


karinchan999
29 May 2018, 09:11

Ooh that's a coincidence. Okay I will keep quiet. Thank you again!