1e41f4b71Sopenharmony_ci# marquee
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci>  **NOTE**
4e41f4b71Sopenharmony_ci>
5e41f4b71Sopenharmony_ci>  This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
6e41f4b71Sopenharmony_ci>  Since API version 6, the text scrolls only when its width exceeds the width of the **\<marquee>** component.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ciThe **\<marquee>** component is used to display a scrolling piece of text.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Required Permissions
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciNone
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Child Components
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciNot supported
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci## Attributes
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ciIn addition to the [universal attributes](js-components-common-attributes.md), the following attributes are supported.
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| Name          | Type    | Default Value | Mandatory  | Description                                      |
25e41f4b71Sopenharmony_ci| ------------ | ------ | ---- | ---- | ---------------------------------------- |
26e41f4b71Sopenharmony_ci| scrollamount | number | 6    | No   | Maximum length of each scroll.                        |
27e41f4b71Sopenharmony_ci| loop         | number | -1   | No   | Number of rolling times. If this parameter is not set, the default value **-1** is used. When the value is less than or equal to **0**, the marquee scrolls continuously.|
28e41f4b71Sopenharmony_ci| direction    | string | left | No   | Direction in which the marquee scrolls, which can be **left** or **right**.            |
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci## Styles
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ciIn addition to the [universal styles](js-components-common-styles.md), the following styles are supported.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci| Name         | Type                        | Default Value       | Mandatory  | Description                                      |
36e41f4b71Sopenharmony_ci| ----------- | -------------------------- | ---------- | ---- | ---------------------------------------- |
37e41f4b71Sopenharmony_ci| color       | &lt;color&gt;              | \#e5000000 | No   | Font color of the scrolling text.                          |
38e41f4b71Sopenharmony_ci| font-size   | &lt;length&gt;             | 37.5       | No   | Font size of the scrolling text.                          |
39e41f4b71Sopenharmony_ci| allow-scale | boolean                    | true       | No   | Whether the font size changes with the system's font size settings.<br>If the **config-changes** tag of **fontSize** is configured for abilities in the **config.json** file, the setting takes effect without application restart.|
40e41f4b71Sopenharmony_ci| font-weight | number \| string | normal     | No   | Font weight of the scrolling text. For details, see **font-weight** of the **[\<text> component](js-components-basic-text.md#styles)**.|
41e41f4b71Sopenharmony_ci| font-family | string                     | sans-serif | No   | Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the specified [custom font](js-components-common-customizing-font.md) is used for the text.|
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci## Events
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ciIn addition to the [universal events](js-components-common-events.md), the following events are supported.
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci| Name    | Parameter  | Description                                      |
49e41f4b71Sopenharmony_ci| ------ | ---- | ---------------------------------------- |
50e41f4b71Sopenharmony_ci| bounce | -    | Triggered when the marquee scrolls to the end.                         |
51e41f4b71Sopenharmony_ci| finish | -    | Triggered when the marquee finishes the specified number of scrollings (value of the **loop** attribute). It can be triggered only when the **loop** attribute is set to a number greater than 0.|
52e41f4b71Sopenharmony_ci| start  | -    | Triggered when the marquee starts to scroll.                          |
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci## Methods
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ciIn addition to the [universal methods](js-components-common-methods.md), the following methods are supported.
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci| Name   | Parameter  | Description   |
59e41f4b71Sopenharmony_ci| ----- | ---- | ----- |
60e41f4b71Sopenharmony_ci| start | -    | Starts scrolling.|
61e41f4b71Sopenharmony_ci| stop  | -    | Stops scrolling.|
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci## Example
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci```html
67e41f4b71Sopenharmony_ci<!-- xxx.hml -->
68e41f4b71Sopenharmony_ci<div class="tutorial-page">
69e41f4b71Sopenharmony_ci  <div class="mymarquee">
70e41f4b71Sopenharmony_ci    <marquee  style="color: {{color1}}" loop="{{loopval}}" scrollamount="{{scroll}}" direction="{{isleft}}" class="marqueetext" 
71e41f4b71Sopenharmony_ci    id="testmarquee" onfinish="setfinish">
72e41f4b71Sopenharmony_ci      Life is a journey, not the destination.
73e41f4b71Sopenharmony_ci    </marquee>
74e41f4b71Sopenharmony_ci  </div>
75e41f4b71Sopenharmony_ci  <div style="width: 600px;height: 150px;flex-direction: row;justify-content: space-around;">
76e41f4b71Sopenharmony_ci    <button onclick="makestart"  value="start"></button>
77e41f4b71Sopenharmony_ci    <button onclick="makestop" value="stop"></button>
78e41f4b71Sopenharmony_ci  </div>
79e41f4b71Sopenharmony_ci</div>
80e41f4b71Sopenharmony_ci```
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci```css
83e41f4b71Sopenharmony_ci/* xxx.css */
84e41f4b71Sopenharmony_ci.tutorial-page {
85e41f4b71Sopenharmony_ci  width: 750px;
86e41f4b71Sopenharmony_ci  height: 100%;
87e41f4b71Sopenharmony_ci  flex-direction: column;
88e41f4b71Sopenharmony_ci  align-items: center;
89e41f4b71Sopenharmony_ci  justify-content: center;
90e41f4b71Sopenharmony_ci}
91e41f4b71Sopenharmony_ci.marqueetext {
92e41f4b71Sopenharmony_ci  font-size: 37px;
93e41f4b71Sopenharmony_ci}
94e41f4b71Sopenharmony_ci.mymarquee {
95e41f4b71Sopenharmony_ci  margin-top: 20px;
96e41f4b71Sopenharmony_ci  width:100%;
97e41f4b71Sopenharmony_ci  height: 100px;
98e41f4b71Sopenharmony_ci  margin-left: 50px;
99e41f4b71Sopenharmony_ci  margin-right: 50px;
100e41f4b71Sopenharmony_ci  border: 1px solid #dc0f27;
101e41f4b71Sopenharmony_ci  border-radius: 15px;
102e41f4b71Sopenharmony_ci  align-items: center;
103e41f4b71Sopenharmony_ci}
104e41f4b71Sopenharmony_cibutton{
105e41f4b71Sopenharmony_ci  width: 200px;
106e41f4b71Sopenharmony_ci  height: 80px;
107e41f4b71Sopenharmony_ci  margin-top: 100px;
108e41f4b71Sopenharmony_ci}
109e41f4b71Sopenharmony_ci```
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci```js
112e41f4b71Sopenharmony_ci// xxx.js
113e41f4b71Sopenharmony_ciexport default {
114e41f4b71Sopenharmony_ci  private: {
115e41f4b71Sopenharmony_ci    loopval: 1,
116e41f4b71Sopenharmony_ci    scroll: 8,
117e41f4b71Sopenharmony_ci    color1: 'red'
118e41f4b71Sopenharmony_ci  },
119e41f4b71Sopenharmony_ci  onInit(){
120e41f4b71Sopenharmony_ci  },
121e41f4b71Sopenharmony_ci  setfinish(e) {
122e41f4b71Sopenharmony_ci    this.loopval=  this.loopval + 1,
123e41f4b71Sopenharmony_ci    this.r = Math.floor(Math.random()*255),
124e41f4b71Sopenharmony_ci    this.g = Math.floor(Math.random()*255),
125e41f4b71Sopenharmony_ci    this.b = Math.floor(Math.random()*255),
126e41f4b71Sopenharmony_ci    this.color1 = 'rgba('+ this.r +','+ this.g +','+ this.b +',0.8)',
127e41f4b71Sopenharmony_ci    this.$element('testmarquee').start(),
128e41f4b71Sopenharmony_ci    this.loopval=  this.loopval - 1
129e41f4b71Sopenharmony_ci  },
130e41f4b71Sopenharmony_ci  makestart(e) {
131e41f4b71Sopenharmony_ci    this.$element('testmarquee').start()
132e41f4b71Sopenharmony_ci  },
133e41f4b71Sopenharmony_ci  makestop(e) {
134e41f4b71Sopenharmony_ci    this.$element('testmarquee').stop()
135e41f4b71Sopenharmony_ci  }
136e41f4b71Sopenharmony_ci}
137e41f4b71Sopenharmony_ci```
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ci![en-us_image_0000001176075554](figures/en-us_image_0000001176075554.gif)
140