We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
quickApp ReferencesQuick AppElementsmarquee

marquee

Overview

Inserts scrolling text. By default, the text is displayed in a single line.

Application Scope

Expand

Item

Description

Applicable devices

Mobile phones and tablets

Applicable regions

Global

Subelements

None

Attributes

In addition to general attributes, the attributes listed in the following table are supported.

Expand

Attribute

Type

Default Value

Mandatory

Description

scrollamount

number

6

No

Amount of scrolling at each interval in pixels.

loop

number

-1

No

Number of times the marquee will scroll. If no value is specified, the default value –1 is used, indicating infinite.

direction

string

left

No

Text scrolling direction. The options are left and right.

Styles

In addition to common styles, the styles listed in the following table are supported.

Expand

Style

Type

Default Value

Mandatory

Description

color

color

0xde000000

No

Font color.

font-size

number

37.5px

No

Font size.

font-weight

lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | normal | bold | bolder

normal

No

Font weight. The default value is normal.

font-family

string

-

No

Font of strings in the element. Android's default fonts normal, sans-serif, serif, and monospace are supported (only for English strings).

To customize fonts, please refer to font-face Style.

Events

In addition to common events, the events listed in the following table are supported.

Expand

Event

Parameter

Triggering Condition

onbounce

-

The marquee scrolls to the end.

onfinish

-

The number of marquee scrolling times reaches the value of the loop attribute. This event can be triggered only when the loop attribute is set to a positive value.

onstart

-

The marquee starts to scroll.

Methods

Expand

Method

Parameter

Description

start

-

Starts to scroll the marquee.

stop

-

Stops scrolling the marquee.

Sample Code

Collapse
Word wrap
Dark theme
Copy code
  1. <template>
  2. <!-- There can only be one root node in the template -->
  3. <div class="container">
  4. <marquee id="bbb" loop="2" direction="right" style="font-weight:lighter; width:700px ;
  5. height:200px;font-family: normal ">huaweiWebsite</marquee>
  6. <marquee id="aaa" direction="left" scrollamount="30px"
  7. style="color : red; width:700px ; height:300px;font-family:network,local" onbounce="b" onfinish="f" onstart="s">
  8. huaweiWebsite
  9. </marquee>
  10. <div class="myDiv">
  11. <input type="button" value="start" onclick="start" />
  12. <input type="button" value="stop" onclick="stop" />
  13. </div>
  14. </div>
  15. </template>
  16. <style>
  17. .container {
  18. flex-direction: column;
  19. justify-content: center;
  20. align-content: center;
  21. align-items: center;
  22. }
  23. .myDiv {
  24. flex-direction: row;
  25. }
  26. #aaa {
  27. font-size: 37.5px;
  28. background-color: #00ffff;
  29. }
  30. @font-face {
  31. font-family: 'sampleA';
  32. src:
  33. /* Here is just an example of a local address. Do not use font files in your product.*/
  34. url('/Common/fonts/FZLTTHBJW.TTF'),
  35. /* Here is just an example of a local address. Do not use font files in your product.*/
  36. url('https://lfmemberdev.hwcloudtest.cn:9094/fastapp/download/FZCCHJW.TTF')
  37. }
  38. @font-face {
  39. font-family: 'local';
  40. /* Here is just an example of a local address. Do not use font files in your product.*/
  41. src: url('/Common/fonts/FZLTTHBJW.TTF');
  42. }
  43. @font-face {
  44. font-family: 'sample';
  45. src:
  46. /* Here is just an example of a local address. Do not use font files in your product.*/
  47. url('/Common/fonts/FZLTTHBJW.TTF'),
  48. /* Here is just an example of a local address. Do not use font files in your product.*/
  49. url('https://lfmemberdev.hwcloudtest.cn:9094/fastapp/download/FZCCHJW.TTF'),
  50. local(serif);
  51. }
  52. @font-face {
  53. font-family: 'system';
  54. src: local('serif');
  55. }
  56. @font-face {
  57. font-family: 'network';
  58. /* Here is just an example of a local address. Do not use font files in your product.*/
  59. src: url('https://lfmemberdev.hwcloudtest.cn:9094/fastapp/download/FZCCHJW.TTF');
  60. }
  61. </style>
  62. <script>
  63. module.exports = {
  64. onInit() {
  65. this.$page.setTitleBar({ text: 'marquee' })
  66. },
  67. onReady: function () {
  68. console.log('onReady ')
  69. },
  70. stop: function () {
  71. this.$element('aaa').stop()
  72. this.$element('bbb').stop()
  73. },
  74. start: function () {
  75. this.$element('aaa').start()
  76. this.$element('bbb').start()
  77. },
  78. b: function () {
  79. console.log('onBounce')
  80. },
  81. f: function () {
  82. console.log('onFinish')
  83. },
  84. s: function () {
  85. console.log('onStart')
  86. }
  87. }
  88. </script>

The following figure shows the final effect.

Version Change History

Expand

Version

Date

Description

1050

2019-09-20

Released the first version.

Search in References
Enter a keyword.