H5-based page width adaptation method and device

The invention provides an H5-based page width adaptation method and device. The method comprises the following steps: setting a basic screen width and a basic font size; obtaining a current screen width value, and calculating a multiplying power according to the screen width value and a basic screen...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: JIN MINJIAN, YAN XIANLIN, CHEN JUN, LI JIAWEN, LUO SHAOMENG, LIN JIAN
Format: Patent
Sprache:chi ; eng
Schlagworte:
Online-Zugang:Volltext bestellen
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:The invention provides an H5-based page width adaptation method and device. The method comprises the following steps: setting a basic screen width and a basic font size; obtaining a current screen width value, and calculating a multiplying power according to the screen width value and a basic screen width; and, according to the multiplying power and the basic font size, obtaining a parent container reference value through calculation, and enabling a parent container assignment to be automatically subjected to page width adaptation, so that automatic adaptation of the page width is achieved through a JS file of a rem algorithm, and adaptation of screens of different sizes is rapidly and accurately achieved. 本发明提供的一种基于H5的页面宽度适配的方法及装置,设置基础屏幕宽度和基础字体大小;获取当前屏幕宽度值,并根据所述屏幕宽度值和基础屏幕宽度计算得到倍率;根据所述倍率和基础字体大小,计算得到父容器基准值,并对父容器赋值自动进行页面宽度适配,利用rem算法的JS文件实现页面宽度的自动适配,快速准确地实现了不同尺寸屏幕适配。