戻る

ページのローディング中表示
ローディングアイコンを表示することによりユーザビリティを期待する方法

ホームページを表示したと仮定します。
画像や他の処理により、ページのすべてが表示されるまで
一定の時間を超えるとユーザーレスポンシビリティが良くないと判断されます。
例えば、
画像などを表示する場合、
画像の大きさや枚数を減らすなどの調整をすることで改善を期待できますが、
”現在、表示中です...”というメッセージを
ページの表示が終わるまでユーザーに通知する方法があります。

例えば、ローディングアイコン(くるくる回る画像)と表示中を知らせるメッセージを
ページ表示中にユーザーにわかりやすいように表示する方法です。

[サンプル]


[CSS]
positionをfixedにすることで、表示中のHTML画面の上(被せるよう)に
ローディングアイコンやメッセージなどを表示させます。
このサンプルでは、z-indexを使用して表示中のHTML要素の上に表示させています。

[divタグ]
(1)ローディングアイコン
(2)メッセージ
を設定しています。
位置調整をするため、divタグにidを設定しています。

[javascript]
let width = window.innerWidth;
画面の幅の取得します。

(1)ローディングアイコン
x = (画面幅 - アイコンの幅) / 2;
y = (画面高さ - (アイコンの高さ + divの高さ)) / 2;
上記のようにアイコンを表示するためのx座標およびy座標を計算します。

(2)メッセージ
const msg = document.getElementById("msg");
const computedStyle=getComputedStyle(msg);
let msgWidth=parseInt(computedStyle.width);
getComputedStyleメソッドとwidthプロパティでブラウザが計算した最終的な幅を取得します。
parseIntとしているのは、pxで値を返すため、他の数値と計算するためint型にキャストしています。

ローディングアイコンは、下記のサイトでダウンロードできます。

[謝辞]
「CMAN」さんの画像を使用させていただいております。
ありがとうございます。
[URL]CMAN【フリーアイコン】
URL[https://sozai.cman.jp/][クリックすると開きます])

このサイトの下記URLでローディングアイコンを掲載してくださっています。
色、方向など指定を好きに設定できるので、重宝できるサイトと思います。
[URL]
CMAN【フリーアイコン】 くるくる回る



戻る
back

display loading page
how to expect usability using display loading icon

Let's say you're viewing a homepage.
If it takes longer than a certain amount of time for the entire page to display due to images and other processing, it is considered to be poor user responsiveness.
example,
When displaying images, etc.,
you can improve the experience by reducing the size or number of images, but
there is also a way to notify users by displaying a "Currently displaying..." message
until the page finishes loading.

For example, you can display a loading icon (a spinning image) and a message informing users that the page is loading.
This is a way to clearly display a loading icon (a spinning image) and a message informing users that the page is loading.
This is a way to clearly display a loading icon (a spinning image) and a message informing users that the page is loading while the page is loading.

[Sample]


[CSS]
By setting the position to fixed, you can display a loading icon, message, etc. on top of (overlaying) the currently displayed HTML screen.
In this sample, z-index is used to display them on top of the currently displayed HTML element.

[div tag]
(1) Loading icon
(2) Message
Settings are made.
An id is set for the div tag to adjust the position.

[javascript]
let width = window.innerWidth;
Get the screen width.

(1) Loading icon
x = (screen width - icon width) / 2;
y = (screen height - (icon height + div height)) / 2;
Calculate the x and y coordinates for displaying the icon as shown above.

(2) Message
const msg = document.getElementById("msg");
const computedStyle=getComputedStyle(msg);
let msgWidth=parseInt(computedStyle.width);
Use the getComputedStyle method and width property to obtain the final width calculated by the browser.
The parseInt method returns a value in pixels, so it is cast to an int type for calculation with other numerical values.

You can download the loading icon from the following website.

[Acknowledgments]
We are using images from "CMAN" with permission.
Thank you.
[URL]CMAN【Free Icon】
URL[https://sozai.cman.jp/][Click to open])

This site offers loading icons at the URL below.
You can customize the color, orientation, and other settings to your liking, making this a very useful site.
[URL]
CMAN【Free Icon】 Spin around


back



著作権情報
ホームページおよプリ等に掲載されている情報等については、いかなる保障もいたしません。
ホームページおよびアプリ等を通じて入手したいかなる情報も複製、販売、出版または使用させたり、
または公開したりすることはできません。
当方は、ホームペーよびアプリ利用したいかなる理由によっての障害等が発生しても、
その結果ホームページおよびアプリ等を利用された本人または他の第三者が被った損害について
一切の責任を負わないものとします。