Floating icon dynamic configuration method and device, electronic equipment and storage medium
By dynamically configuring floating icons and adjusting their display status according to environmental monitoring events, the applicability and user experience issues of floating icons in different environments are solved, and better interface interaction and page presentation are achieved.
Patent Information
- Application Number
- CN202410429086.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-10
- Publication Date
- 2024-08-27
AI Technical Summary
Existing floating icons need to be rebuilt under different operating environments, resulting in page space usage and poor user experience, and making it difficult to optimize page content presentation and applicability.
Provides a dynamic configuration method for floating icons. It constructs floating icon graphics on the display page by receiving setting instructions, monitors sliding or scrolling events according to the usage environment (HTML5 or mobile APP), and adjusts the offset of the floating icon to hide or display, optimizing Page rendering.
It improves the applicability and user experience of floating icons, is suitable for different environments, enhances the interface interaction effect, and optimizes the presentation of page content.
Smart Images

Figure CN118550431A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method, device, electronic device and storage medium for dynamically configuring a floating icon. Background Art
[0002] In the prior art, floating icons usually require specific settings for the operating environment. For example, a floating icon running in an Html5 (HyperText Markup Language 5) environment needs to be constructed according to the characteristics of Html5, but it is not applicable to an APP (Application) environment. If it needs to be used in an App environment, it needs to be rebuilt. In addition, existing floating icons will occupy page space or interfere with the presentation of page content to a certain extent, resulting in a poor user experience.
[0003] Therefore, how to set the floating icon to optimize the page content presentation, improve applicability, and enhance user experience has become a problem. To address this problem, a method for dynamically configuring the floating icon needs to be proposed. Summary of the invention
[0004] In view of the above reasons, it is necessary to provide a method, device, electronic device and storage medium for dynamically configuring a floating icon to optimize the presentation of page content and improve applicability.
[0005] To achieve the above object, the present invention provides a method for dynamically configuring a floating icon, the method comprising the following steps:
[0006] S1. Receive a setting instruction for a floating icon, construct a floating icon graphic on a display page by dividing elements of content of a page tag according to setting information of the setting instruction, and add a sliding event, a scroll start event, and a scroll end event to the display page by a scroll component;
[0007] S2. Determine the usage environment of the display page. If the usage environment of the display page is an HTML5 page, monitor the sliding state of the display page through the sliding event. When the start of the sliding event is monitored, change the offset of the floating icon graphic to a first value to trigger the hidden state of the floating icon graphic on the display page. When the end of the sliding event is monitored, change the offset of the floating icon graphic to a second value to trigger the display state of the floating icon graphic on the display page.
[0008] S3. If the usage environment of the display page is a mobile APP page, the sliding state of the display page is monitored through the scroll start event and the scroll end event. When the scroll start event is triggered, the offset of the floating icon graphic is changed to a first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to a second value to trigger the displayed state of the floating icon graphic on the display page.
[0009] Optionally, monitoring the sliding state of the display page through the sliding event includes:
[0010] After each preset time, the scrolling distance of the displayed page within the preset time is obtained through the sliding event, and compared with the scrolling distance within the previous preset time;
[0011] When the difference between the two is not equal to 0, it is determined that the sliding event has started;
[0012] When the difference between the two is equal to 0, it is determined that the sliding event ends.
[0013] Optionally, the step S2 of changing the offset of the floating icon graphic to a first value includes:
[0014] A first value is set according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic, and the offset of the floating icon is changed to the first value.
[0015] Optionally, the step of changing the offset of the floating icon graphic to a first value in S3 includes:
[0016] Setting a first value according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic;
[0017] Using the transition attribute of the animation module in the code of the display page, the offset value of the conversion function related to the floating icon graphic in the code is changed to the first value.
[0018] Optionally, determining the usage environment of the display page includes:
[0019] The Weex environment variables in the code of the display page are obtained, and the use environment of the display page is determined by the Weex environment variables.
[0020] Optionally, the display page is a Weex page; and the step of constructing a floating icon graphic by dividing the elements of the content of the page tag on the display page includes:
[0021] Add a content division element to the page tag of the display page, edit the content division element according to the setting information, and save the edited content division element as a floating icon graphic to the server.
[0022] Optionally, editing the content division element according to the setting information includes:
[0023] The parameters of the floating icon graphic are acquired according to the setting information, and the content division elements are edited based on the parameters of the floating icon graphic.
[0024] The present invention also provides a floating icon dynamic configuration device, the floating icon dynamic configuration device comprising:
[0025] A construction module, used to receive a setting instruction of a floating icon, construct a floating icon graphic on a display page by dividing elements of content of a page tag according to setting information of the setting instruction, and add a sliding event, a scrolling start event and a scrolling end event to the display page through a scrolling component;
[0026] A determination module, used to determine the usage environment of the display page;
[0027] The first environment module is used for monitoring the sliding state of the display page through the sliding event if the use environment of the display page is an HTML5 page, and when the start of the sliding event is monitored, changing the offset of the floating icon graphic to a first value to trigger the hidden state of the floating icon graphic on the display page, and when the end of the sliding event is monitored, changing the offset of the floating icon graphic to a second value to trigger the display state of the floating icon graphic on the display page;
[0028] The second environment module is used to monitor the sliding state of the display page through the scroll start event and the scroll end event if the usage environment of the display page is a mobile APP page. When the scroll start event is triggered, the offset of the floating icon graphic is changed to the first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to the second value to trigger the display state of the floating icon graphic on the display page.
[0029] The present invention also provides an electronic device, which includes a memory and a processor, wherein the memory includes a floating icon dynamic configuration program, and when the floating icon dynamic configuration program is executed by the processor, any step in the floating icon dynamic configuration method described above is implemented.
[0030] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium, which includes a floating icon dynamic configuration program. When the floating icon dynamic configuration program is executed by a processor, any step in the floating icon dynamic configuration method described above is implemented.
[0031] The present invention relates to the field of computers, and provides a method for dynamically configuring a floating icon, the method comprising: constructing a floating icon graphic on a display page, adding a sliding event, a scroll start event, and a scroll end event to the display page; when the use environment of the display page is an HTML5 page, the sliding event of the display page is monitored through the sliding event, when the sliding event starts, the offset of the graphic is changed to a first value, and when the sliding event ends, the offset of the graphic is changed to a second value; when the use environment is a mobile APP page, the sliding event of the display page is monitored through the scroll start event and the scroll end event, when the scroll start event starts, the offset of the graphic is changed to the first value, and when the scroll end event starts, the offset of the floating icon is changed to the second value. The present invention adopts different ways to monitor according to different use environments of the display page, improves the human-computer interaction effect between the user and the device, and has wide applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of the internal structure of an electronic device implementing a method for dynamically configuring a floating icon provided by an embodiment of the present invention;
[0033] Figure 2 A schematic diagram of a module of a floating icon dynamic configuration device provided by an embodiment of the present invention;
[0034] Figure 3 A schematic diagram of a flow chart of a method for dynamically configuring a floating icon provided by an embodiment of the present invention;
[0035] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0036] The principle and spirit of the present invention will be described below with reference to several specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0037] See also Figure 1 FIG. 1 is a schematic diagram of an optional hardware architecture of an electronic device proposed in the present invention. In this embodiment, the electronic device 10 may include, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can communicate with each other via a communication bus 14. It should be noted that Figure 1Only the electronic device 10 is shown having components 11 - 14 , but it is understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0038] Among them, the memory 11 includes at least one type of computer-readable storage medium, and the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 10, such as a hard disk or memory of the electronic device 10. In other embodiments, the memory 11 can also be an outsourced storage device of the electronic device 10, such as a plug-in hard disk equipped on the electronic device 10, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 11 can also include both the internal storage unit of the electronic device 10 and its outsourced storage device. In this embodiment, the memory 11 is generally used to store the operating system and various application software installed on the electronic device 10, such as a floating icon dynamic configuration program, etc. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
[0039] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 12 is generally used to control the overall operation of the electronic device 10. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running a floating icon dynamic configuration program.
[0040] The network interface 13 may include a wireless network interface or a wired network interface. The network interface 13 is generally used to establish a communication connection between the electronic device 10 and other electronic devices.
[0041] The communication bus 14 is used to realize the communication connection between the components 11-13.
[0042] Optionally, the electronic device 10 may further include a user interface ( Figure 1 (not shown in the figure), the user interface may include a display, an input unit such as a keyboard, wherein the user interface may also include a standard wired interface, a wireless interface, etc.
[0043] Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED touch device, etc. Further, the display may also be referred to as a display screen or a display unit, which is used to display information processed in the electronic device 10 and to display a visual user interface.
[0044] Optionally, in some embodiments, the electronic device 10 may further include an audio unit (audio unit Figure 1 (not shown in the figure), the audio unit can convert the received or stored audio data into an audio signal when the electronic device 10 is in a call signal receiving mode, a talk mode, a recording mode, a voice recognition mode, a broadcast receiving mode, etc.; further, the electronic device 10 may also include an audio output unit, which outputs the audio signal converted by the audio unit, and the audio output unit can also provide audio output related to a specific function performed by the electronic device 10 (such as a call signal reception sound, a message reception sound, etc.), and the audio output unit may include a speaker, a buzzer, etc.
[0045] Optionally, in some embodiments, the electronic device 10 may further include an alarm unit (not shown in the figure), which may provide an output to notify the electronic device 10 of the occurrence of an event. Typical events may include call reception, message reception, key signal input, touch input, and the like. In addition to audio or video output, the alarm unit may provide output in different ways to notify the occurrence of an event. For example, the alarm unit may provide an output in the form of a vibration, and when a call, message, or some other event that may cause the electronic device 10 to enter a communication mode is received, the alarm unit may provide a tactile output (i.e., vibration) to notify the user.
[0046] In the above embodiment, the processor 12 implements the following steps when executing the floating icon dynamic configuration program stored in the memory 11:
[0047] S1. Receive a setting instruction for a floating icon, construct a floating icon graphic on a display page by dividing elements of content of a page tag according to setting information of the setting instruction, and add a sliding event, a scroll start event, and a scroll end event to the display page by a scroll component;
[0048] S2. Determine the usage environment of the display page. If the usage environment of the display page is an HTML5 page, monitor the sliding state of the display page through the sliding event. When the start of the sliding event is monitored, change the offset of the floating icon graphic to a first value to trigger the hidden state of the floating icon graphic on the display page. When the end of the sliding event is monitored, change the offset of the floating icon graphic to a second value to trigger the display state of the floating icon graphic on the display page.
[0049] S3. If the usage environment of the display page is a mobile APP page, the sliding state of the display page is monitored through the scroll start event and the scroll end event. When the scroll start event is triggered, the offset of the floating icon graphic is changed to a first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to a second value to trigger the displayed state of the floating icon graphic on the display page.
[0050] For a detailed description of the above steps, please refer to the following Figure 2 Module diagram of the floating icon dynamic configuration method and Figure 3 A flowchart of a method for dynamically configuring a floating icon is presented.
[0051] Reference Figure 2 1 is a schematic diagram of modules in an embodiment of a floating icon dynamic configuration device of the present invention. In this embodiment, multiple modules are stored in a memory 11 and executed by a processor 12 to implement the present invention. The module referred to in the present invention refers to a series of computer program instruction segments that can implement specific functions.
[0052] The floating icon dynamic configuration device may include: a construction module 201 , a judgment module 202 , a first environment module 203 and a second module 204 .
[0053] Construction module 201 is used to receive the setting instruction of the floating icon, construct the floating icon graphic on the display page through the content division elements of the page tag according to the setting information of the setting instruction, and add sliding events, scrolling start events and scrolling end events to the display page through the scrolling component.
[0054] Specifically, the display page is a Weex page; the floating icon graphic is constructed by dividing the elements of the content of the page tag on the display page, including:
[0055] Add a content division element to the page tag of the display page, edit the content division element according to the setting information, and save the edited content division element as a floating icon graphic to the server.
[0056] Specifically, the editing the content division element according to the setting information includes:
[0057] The parameters of the floating icon graphic are acquired according to the setting information, and the content division elements are edited based on the parameters of the floating icon graphic.
[0058] In one embodiment, the content division element is a div element. Weex is a framework for developing high-performance native applications using the popular Web (World Wide Web) development experience, and the display page developed based on this is called a Weex page. When the display page starts to scroll, a sliding event is generated, and when the display page ends scrolling, the sliding event ends. The scroll component (scroller) is a core component in Weex, which provides the functions and characteristics of a scrolling container. Scroll start event (scroll start): triggered when the display page starts scrolling, the content height and list offset of the current display page will be returned; scroll end event (scroll end): similar to scroll star, triggered when the display page ends scrolling, the content height and list offset of the current display page will be returned. Based on the characteristics of the above events, the generation and end of the user sliding event can be judged according to the returned data.
[0059] In one embodiment, the floating icon graphic is a circle with a diameter of 1 cm (primary pattern), so the div element needs to be set to a circle with a diameter of at least 1 cm, or be able to accommodate a circle with a diameter of 1 cm. When the user clicks the circle, the circle can be expanded into three circles with a diameter of 0.5 cm (secondary pattern), and so on. The div element also needs to be edited according to the secondary pattern.
[0060] In one embodiment, the font transparency of the user's current page is 70%. In order not to interfere with the presentation of the content and improve the user experience, the transparency of the floating icon graphic can be set by setting a div element, and the transparency of the floating icon graphic can be set to 50%.
[0061] The determination module 202 is used to determine the usage environment of the display page.
[0062] Specifically, determining the usage environment of the display page includes:
[0063] The Weex environment variables in the code of the display page are obtained, and the use environment of the display page is determined by the Weex environment variables.
[0064] In one embodiment, the code of Weex environment variables is "const G_ENV = weex && weex.config && weex.config.env? weex.config.env", then the current use environment is judged to be a mobile APP page. The code of Weex environment variables is "G_ENV.platform = 'Web'", then the current use environment is judged to be a fifth generation Hypertext Markup Language (HTML5) page.
[0065] The first environment module 203 is used to monitor the sliding state of the display page through the sliding event if the usage environment of the display page is an HTML5 page. When the start of the sliding event is monitored, the offset of the floating icon graphic is changed to a first value to trigger the hiding state of the floating icon graphic in the display page. When the end of the sliding event is monitored, the offset of the floating icon graphic is changed to a second value to trigger the display state of the floating icon graphic in the display page.
[0066] Specifically, monitoring the sliding state of the display page through the sliding event includes:
[0067] After each preset time, the scrolling distance of the displayed page within the preset time is obtained through the sliding event, and compared with the scrolling distance within the previous preset time;
[0068] When the difference between the two is not equal to 0, it is determined that the sliding event has started;
[0069] When the difference between the two is equal to 0, it is determined that the sliding event ends.
[0070] Specifically, the step of changing the offset of the floating icon graphic to a first value includes:
[0071] A first value is set according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic, and the offset of the floating icon is changed to the first value.
[0072] In one embodiment, the data of the floating icon graphic is obtained by querying the class name of the floating icon graphic code, and the numerical value (first numerical value) corresponding to the state of the sliding event generation and the numerical value (second numerical value) corresponding to the state of the sliding event end are set according to the initial position of the floating icon graphic on the display page, the size of the floating icon graphic, and the size of the display page. The first numerical value is a numerical value for hiding the floating icon graphic, and its specific value is not limited. The second numerical value is a numerical value for changing the floating icon graphic from a hidden state to a new display state, and its specific value is also not limited.
[0073] In one embodiment, the scroll distance of the initial page is 0px, and the scroll distance of the page is obtained every 10 milliseconds. The scroll distance value obtained at the 20th millisecond is 100px, and the scroll distance value obtained at the 10th millisecond is 150px, indicating that the page has scrolled down 50px within 10-20 milliseconds, and a sliding event is generated. The PX unit is "Pixel", which is composed of the letters of the two words Picture and Element and is used to calculate a digital image. For example, when the pixel resolution of a computer image is 72ppi (px per inch), 1px = 0.04cm, 10px = 0.4cm.
[0074] In one embodiment, the floating icon graphic is a circle with a radius of 10px, and the center coordinates of the circle are taken as the initial position of the circle, and the center coordinates are (10px, 10px). When a sliding event occurs, if the right offset is set to -10px, the floating icon graphic is offset to the left by 10px, so that the floating icon graphic achieves a semi-hidden effect. If the right offset is set to -20px (first value), the floating icon graphic is offset to the left by 20px, so that the floating icon graphic achieves a fully hidden effect. When the sliding event ends, the right offset is set to 0px (second value), and the floating icon graphic returns to its initial position. In another embodiment, the upper offset can be set to hide and display the floating icon graphic in the up and down directions.
[0075] The present invention uses different methods to monitor sliding events based on different usage environments. It is suitable for various mobile applications based on Weex technology, has strong applicability, and can enhance interface interaction effects and improve user experience.
[0076] The second environment module 204 is used to monitor the sliding state of the display page through the scroll start event and the scroll end event if the usage environment of the display page is a mobile APP page. When the scroll start event is triggered, the offset of the floating icon graphic is changed to the first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to the second value to trigger the displayed state of the floating icon graphic on the display page.
[0077] Specifically, the step of changing the offset of the floating icon graphic to a first value includes:
[0078] Setting a first value according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic;
[0079] Using the transition attribute of the animation module (animation) in the code of the display page, the offset value (translate) of the transformation function (transform) of the floating icon graphic in the code is changed to the first value.
[0080] In one embodiment, the floating icon graphic is a circle with a radius of 10px, and the coordinates of its center are taken as the initial position of the circle, and the coordinates of its center are (10px, 10px). When the scroll start event (scroll start) starts, translateX (the offset value parameter of the image translation to the X axis) is set to -10px, that is, "translateX(-10px)", and the floating icon graphic is offset to the left by 10px, so that the floating icon graphic achieves a semi-hidden effect; when the scroll end event (scroll end) starts, translateX is set to 0px, that is, "translateX(0px)", so as to achieve the effect of restoring the floating icon graphic to the original position, wherein the first value is 10px and the second value is 0px. In another embodiment, the value of translateY (the offset value parameter of the image translation to the Y axis) can be set to hide and display the floating icon graphic in the up and down directions.
[0081] The present invention uses different technical means to display or hide the floating icon according to different usage environments, effectively improving the human-computer interaction effect between the user and the device and improving the user experience.
[0082] The present invention relates to the field of computers, and provides a method for dynamically configuring a floating icon, the method comprising: constructing a floating icon graphic on a display page, adding a sliding event, a scroll start event, and a scroll end event to the display page; when the use environment of the display page is an HTML5 page, the sliding event of the display page is monitored through the sliding event, when the sliding event starts, the offset of the graphic is changed to a first value, and when the sliding event ends, the offset of the graphic is changed to a second value; when the use environment is a mobile APP page, the sliding event of the display page is monitored through the scroll start event and the scroll end event, when the scroll start event starts, the offset of the graphic is changed to the first value, and when the scroll end event starts, the offset of the floating icon is changed to the second value. The present invention adopts different ways to monitor according to different use environments of the display page, improves the human-computer interaction effect between the user and the device, and has wide applicability.
[0083] Reference Figure 3 FIG. 1 is a flow chart of an embodiment of a method for dynamically configuring a floating icon according to the present invention. In this embodiment, the processor 12 of the electronic device 10 executes the program for dynamically configuring a floating icon in the memory 11 to implement the following steps of the method for dynamically configuring a floating icon:
[0084] Step S301, receiving a setting instruction for a floating icon, constructing a floating icon graphic on a display page through content division elements of a page tag according to setting information of the setting instruction, and adding a sliding event, a scrolling start event, and a scrolling end event to the display page through a scrolling component.
[0085] Specifically, the display page is a Weex page; the floating icon graphics are constructed by dividing the elements of the content of the page tag on the display page, including:
[0086] Add a content division element to the page tag of the display page, edit the content division element according to the setting information, and save the edited content division element as a floating icon graphic to the server.
[0087] Specifically, the editing the content division element according to the setting information includes:
[0088] The parameters of the floating icon graphic are acquired according to the setting information, and the content division elements are edited based on the parameters of the floating icon graphic.
[0089] In one embodiment, the content division element is a div element. Weex is a framework for developing high-performance native applications using the popular Web (World Wide Web) development experience, and the display page developed based on this is called a Weex page. When the display page starts to scroll, a sliding event is generated, and when the display page ends scrolling, the sliding event ends. The scroll component (scroller) is a core component in Weex, which provides the functions and characteristics of a scrolling container. Scroll start event (scrollstart): triggered when the display page starts scrolling, the content height and list offset of the current display page will be returned; scroll end event (scrollend): similar to scrollstar, triggered when the display page ends scrolling, the content height and list offset of the current display page will be returned. Based on the characteristics of the above events, the generation and end of the user sliding event can be judged according to the returned data.
[0090] In one embodiment, the floating icon graphic is a circle with a diameter of 1 cm (primary pattern), so the div element needs to be set to a circle with a diameter of at least 1 cm, or be able to accommodate a circle with a diameter of 1 cm. When the user clicks the circle, the circle can be expanded into three circles with a diameter of 0.5 cm (secondary pattern), and so on. The div element also needs to be edited according to the secondary pattern.
[0091] In one embodiment, the font transparency of the user's current page is 70%. In order not to interfere with the presentation of the content and improve the user experience, the transparency of the floating icon graphic can be set by setting a div element, and the transparency of the floating icon graphic can be set to 50%.
[0092] Step S302, determine the usage environment of the display page. If the usage environment of the display page is an HTML5 page, monitor the sliding state of the display page through the sliding event. When the start of the sliding event is monitored, change the offset of the floating icon graphic to a first value to trigger the hidden state of the floating icon graphic in the display page. When the end of the sliding event is monitored, change the offset of the floating icon graphic to a second value to trigger the displayed state of the floating icon graphic in the display page.
[0093] Specifically, determining the usage environment of the display page includes:
[0094] The Weex environment variables in the code of the display page are obtained, and the use environment of the display page is determined by the Weex environment variables.
[0095] In one embodiment, the code of Weex environment variables is "const G_ENV = weex && weex.config && weex.config.env? weex.config.env", then the current use environment is judged to be a mobile APP page. The code of Weex environment variables is "G_ENV.platform = 'Web'", then the current use environment is judged to be a fifth generation Hypertext Markup Language (HTML5) page.
[0096] Specifically, monitoring the sliding state of the display page through the sliding event includes:
[0097] After each preset time, the scrolling distance of the displayed page within the preset time is obtained through the sliding event, and compared with the scrolling distance within the previous preset time;
[0098] When the difference between the two is not equal to 0, it is determined that the sliding event has started;
[0099] When the difference between the two is equal to 0, it is determined that the sliding event ends.
[0100] Specifically, the step of changing the offset of the floating icon graphic to a first value includes:
[0101] A first value is set according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic, and the offset of the floating icon is changed to the first value.
[0102] In one embodiment, the data of the floating icon graphic is obtained by querying the class name of the floating icon graphic code, and the numerical value (first numerical value) corresponding to the state of the sliding event generation and the numerical value (second numerical value) corresponding to the state of the sliding event end are set according to the initial position of the floating icon graphic on the display page, the size of the floating icon graphic, and the size of the display page. The first numerical value is a numerical value for hiding the floating icon graphic, and its specific value is not limited. The second numerical value is a numerical value for changing the floating icon graphic from a hidden state to a new display state, and its specific value is also not limited.
[0103] In one embodiment, the scroll distance of the initial page is 0px, and the scroll distance of the page is obtained every 10 milliseconds. The scroll distance value obtained at the 20th millisecond is 100px, and the scroll distance value obtained at the 10th millisecond is 150px, indicating that the page has scrolled down 50px within 10-20 milliseconds, and a sliding event is generated. The PX unit is "Pixel", which is composed of the letters of the two words Picture and Element and is used to calculate a digital image. For example, when the pixel resolution of a computer image is 72ppi (px per inch), 1px = 0.04cm, 10px = 0.4cm. In one embodiment, the floating icon graphic is a circle with a radius of 10px, and the center coordinates of the circle are taken as the initial position of the circle, and the center coordinates are (10px, 10px). When a sliding event occurs, if the right offset is set to -10px, the floating icon graphic is offset to the left by 10px, so that the floating icon graphic achieves a semi-hidden effect. If the right offset is set to -20px (first value), the floating icon graphic is offset to the left by 20px, so that the floating icon graphic achieves a fully hidden effect. When the sliding event ends, the right offset is set to 0px (second value), and the floating icon graphic returns to its initial position. In another embodiment, the upper offset can be set to hide and display the floating icon graphic in the up and down directions.
[0104] The present invention uses different methods to monitor sliding events based on different usage environments. It is suitable for various mobile applications based on Weex technology, has strong applicability, and can enhance interface interaction effects and improve user experience.
[0105] Step S303: If the usage environment of the display page is a mobile APP page, the sliding state of the display page is monitored through the scroll start event and the scroll end event. When the scroll start event is triggered, the offset of the floating icon graphic is changed to a first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to a second value to trigger the displayed state of the floating icon graphic on the display page.
[0106] Specifically, the step of changing the offset of the floating icon graphic to a first value includes:
[0107] Setting a first value according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic;
[0108] Using the transition attribute of the animation module (animation) in the code of the display page, the offset value (translate) of the transformation function (transform) of the floating icon graphic in the code is changed to the first value.
[0109] In one embodiment, the floating icon graphic is a circle with a radius of 10px, and the coordinates of its center are taken as the initial position of the circle, and the coordinates of its center are (10px, 10px). When the scroll start event (scroll start) starts, translateX (the offset value parameter of the image translation to the X axis) is set to -10px, that is, "translateX(-10px)", and the floating icon graphic is offset to the left by 10px, so that the floating icon graphic achieves a semi-hidden effect; when the scroll end event (scroll end) starts, translateX is set to 0px, that is, "translateX(0px)", so as to achieve the effect of restoring the floating icon graphic to the original position, wherein the first value is 10px and the second value is 0px. In another embodiment, the value of translateY (the offset value parameter of the image translation to the Y axis) can be set to hide and display the floating icon graphic in the up and down directions.
[0110] The present invention uses different technical means to display or hide the floating icon according to different usage environments, effectively improving the human-computer interaction effect between the user and the device and improving the user experience.
[0111] The present invention relates to the field of computers, and provides a method for dynamically configuring a floating icon, the method comprising: constructing a floating icon graphic on a display page, adding a sliding event, a scroll start event, and a scroll end event to the display page; when the use environment of the display page is an HTML5 page, the sliding event of the display page is monitored through the sliding event, when the sliding event starts, the offset of the graphic is changed to a first value, and when the sliding event ends, the offset of the graphic is changed to a second value; when the use environment is a mobile APP page, the sliding event of the display page is monitored through the scroll start event and the scroll end event, when the scroll start event starts, the offset of the graphic is changed to the first value, and when the scroll end event starts, the offset of the floating icon is changed to the second value. The present invention adopts different ways to monitor according to different use environments of the display page, improves the human-computer interaction effect between the user and the device, and has wide applicability.
[0112] In addition, the embodiment of the present invention further proposes a computer-readable storage medium, which may be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, etc. The computer-readable storage medium includes a floating icon dynamic configuration program, and when the floating icon dynamic configuration program is executed by a processor, the following operations are implemented:
[0113] S1. Receive a setting instruction for a floating icon, construct a floating icon graphic on a display page by dividing elements of content of a page tag according to setting information of the setting instruction, and add a sliding event, a scroll start event, and a scroll end event to the display page by a scroll component;
[0114] S2. Determine the usage environment of the display page. If the usage environment of the display page is an HTML5 page, monitor the sliding state of the display page through the sliding event. When the start of the sliding event is monitored, change the offset of the floating icon graphic to a first value to trigger the hidden state of the floating icon graphic on the display page. When the end of the sliding event is monitored, change the offset of the floating icon graphic to a second value to trigger the display state of the floating icon graphic on the display page.
[0115] S3. If the usage environment of the display page is a mobile APP page, the sliding state of the display page is monitored through the scroll start event and the scroll end event. When the scroll start event is triggered, the offset of the floating icon graphic is changed to a first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to a second value to trigger the displayed state of the floating icon graphic on the display page.
[0116] The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the above-mentioned floating icon dynamic configuration method and the electronic device 10, and will not be described in detail herein.
[0117] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.
[0118] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. Through the description of the above implementation modes, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases the former is a better implementation mode. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0119] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for dynamically configuring a floating icon. It is characterized in that The method includes: S1. Receive a setting instruction for a floating icon, construct a floating icon graphic on a display page by dividing elements of content of a page tag according to setting information of the setting instruction, and add a sliding event, a scroll start event, and a scroll end event to the display page by a scroll component; S2. Determine the usage environment of the display page. If the usage environment of the display page is an HTML5 page, monitor the sliding state of the display page through the sliding event. When the start of the sliding event is monitored, change the offset of the floating icon graphic to a first value to trigger the hidden state of the floating icon graphic on the display page. When the end of the sliding event is monitored, change the offset of the floating icon graphic to a second value to trigger the display state of the floating icon graphic on the display page. S3. If the usage environment of the display page is a mobile APP page, the sliding state of the display page is monitored through the scroll start event and the scroll end event. When the scroll start event is triggered, the offset of the floating icon graphic is changed to a first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to a second value to trigger the displayed state of the floating icon graphic on the display page.
2. The method for dynamically configuring a floating icon according to claim 1, It is characterized in that The monitoring the sliding state of the display page through the sliding event includes: After each preset time, the scrolling distance of the displayed page within the preset time is obtained through the sliding event, and compared with the scrolling distance within the previous preset time; When the difference between the two is not equal to 0, it is determined that the sliding event has started; When the difference between the two is equal to 0, it is determined that the sliding event ends.
3. The method for dynamically configuring a floating icon according to claim 1, It is characterized in that S2: changing the offset of the floating icon graphic to a first value, including: A first value is set according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic, and the offset of the floating icon is changed to the first value.
4. The method for dynamically configuring a floating icon according to claim 1, It is characterized in that S3, changing the offset of the floating icon graphic to a first value, includes: Setting a first value according to the initial coordinates of the floating icon graphic on the display page and the size of the floating icon graphic; Using the transition attribute of the animation module in the code of the display page, the offset value of the conversion function related to the floating icon graphic in the code is changed to the first value.
5. The method for dynamically configuring a floating icon according to claim 1, It is characterized in that The determining of the usage environment of the display page includes: The Weex environment variables in the code of the display page are obtained, and the use environment of the display page is determined by the Weex environment variables.
6. The method for dynamically configuring a floating icon according to claim 1, It is characterized in that The display page is the Weex page; The method of constructing a floating icon graphic by dividing the elements of the content of the page tag on the display page includes: Add a content division element to the page tag of the display page, edit the content division element according to the setting information, and save the edited content division element as a floating icon graphic to the server.
7. The method for dynamically configuring a floating icon according to claim 6, It is characterized in that The editing the content division element according to the setting information includes: The parameters of the floating icon graphic are acquired according to the setting information, and the content division elements are edited based on the parameters of the floating icon graphic.
8. A floating icon dynamic configuration device, It is characterized in that The device comprises: A construction module, used to receive a setting instruction of a floating icon, construct a floating icon graphic on a display page by dividing elements of content of a page tag according to setting information of the setting instruction, and add a sliding event, a scrolling start event and a scrolling end event to the display page through a scrolling component; A determination module, used to determine the usage environment of the display page; The first environment module is used for monitoring the sliding state of the display page through the sliding event if the use environment of the display page is an HTML5 page, and when the start of the sliding event is monitored, changing the offset of the floating icon graphic to a first value to trigger the hidden state of the floating icon graphic on the display page, and when the end of the sliding event is monitored, changing the offset of the floating icon graphic to a second value to trigger the display state of the floating icon graphic on the display page; The second environment module is used to monitor the sliding state of the display page through the scroll start event and the scroll end event if the usage environment of the display page is a mobile APP page. When the scroll start event is triggered, the offset of the floating icon graphic is changed to the first value to trigger the hidden state of the floating icon graphic on the display page. When the scroll end event is triggered, the offset of the floating icon graphic is changed to the second value to trigger the display state of the floating icon graphic on the display page.
9. An electronic device, It is characterized in that The electronic device includes a memory and a processor. The memory stores a floating icon dynamic configuration program. When the floating icon dynamic configuration program is executed by the processor, the floating icon dynamic configuration method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a floating icon dynamic configuration program. When the floating icon dynamic configuration program is executed by a processor, the floating icon dynamic configuration method according to any one of claims 1 to 7 is implemented.
