Trick to ensure pages are accessible in all devices, etc.

Workarounds and usability notes.

Trick to ensure pages are accessible in all devices, etc.

Postby Clifton » Wed Apr 15, 2015 6:51 am

ToolBook pages are centered by default in within the browser window area.
While this is fine in most cases, if the user is viewing the page on a device with a smaller viewport than the size of your page, it will be clipped at both the left and right margins. While the user can scroll the page to the right, this prevents the user from ever seeing the portion of the page clipped to the left. This is a particularly bad situation on mobile devices.

Try setPageContentPosition() to fix this problem

Add this action to the on load page event of the FIRST page of your book:

Image 1.png
Use setPageContentPosition() on load page
Image 1.png (64.42 KiB) Viewed 581 times

What does this do?
The function setPageContentPosition() allows you to do many things with the page position, size, transparency, etc. It this example, we are using the "@0" value to tell the function that when the user resizes the page to disable ToolBook's internal centering function if the page reaches a minimum X and Y position of 0 in the viewport area of the browser. You don't really have to enter "@0" for the top parameter but you may still want to set a minimum for the top anyway. The value used can be any integer. If the "@" symbol were not used, then the function would place the page position at exactly the X Y coordinate of 0 x 0 in the viewport area regardless of the browser window/device size.

NOTE: You only have to execute setPageContentPosition() ONCE on the first page of your application as the setting is persistent until the function is run again. Each time the function is executed is CURRENT settings become the new persistent ones from that point onward.

HAVE FUN!
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron