Method and device for displaying page elements
By sorting the page elements and determining the sliding operation, the alternate ceiling display of multiple page elements is realized, which solves the problem of the inability to realize the alternate ceiling display of multiple titles in the existing technology, and improves the display efficiency and user experience of page elements.
Patent Information
- Application Number
- CN202011158539.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-26
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-10-26
AI Technical Summary
The existing ceiling-ceiling method cannot realize the alternate ceiling-ceiling display of multiple titles, especially when the page is sliding, it cannot effectively display the ceiling-ceiling status of multiple page elements.
By obtaining the orderly arrangement of page elements, sorting them according to the distance between the elements and the top of the page, and judging each page element in response to the sliding operation. If it is in the visible area and meets the ceiling conditions, it will be displayed at the ceiling position, otherwise it will remain fixed. , using the positional relationship between the page element and its next element to determine the ceiling conditions.
Alternate ceiling display between multiple page elements is realized, which solves the problem in the existing technology that multiple titles cannot be alternately ceiling displayed, and improves the display efficiency and user experience of page elements.
Smart Images

Figure CN113760154B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for displaying page elements. Background Art
[0002] Generally, the existing ceiling method mainly positions the element at a fixed position on the page by directly setting the position of the element, so that the position of the element does not change when the page is slid. When there are multiple contents to be displayed on the page, the existing ceiling method cannot realize the alternating ceiling display of multiple titles. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method and device for displaying page elements, which can solve the problem that the existing ceiling-mounted method cannot realize the alternate ceiling-mounted display of multiple titles.
[0004] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for displaying page elements is provided.
[0005] The method for displaying page elements in an embodiment of the present invention includes:
[0006] Acquire at least one orderly arranged page element included in the page, wherein the order of the page elements is obtained by sorting the page elements from small to large according to the distance between the page elements and the top of the page;
[0007] In response to a sliding operation on the page, each page element is judged; if the page element is located within the visible area and satisfies a ceiling condition, the page element is displayed at the ceiling position of the page; when the page slides and other page elements do not satisfy the ceiling condition, the page element remains fixed at the ceiling position; wherein, whether the page element satisfies the ceiling condition is determined based on a positional relationship between the page element and its next page element and the ceiling position, and the next page element is the first page element arranged after the page element.
[0008] Optionally, determining each page element includes:
[0009] For each page element, if the sliding distance of the page is greater than or equal to the first parameter, it is determined that the page element is within the visible area of the page;
[0010] Otherwise, it is determined that the page element does not appear within the visible area of the page;
[0011] The first parameter is calculated based on the distance between the page element and the top of the page, the size of the page element along the sliding direction, and the size of the visible area along the sliding direction.
[0012] Optionally, determining whether the page element satisfies the ceiling condition according to the positional relationship between the page element and its next page element and the ceiling position includes:
[0013] For each page element, determine whether the page element meets the ceiling condition based on the distance between the page element and the top of the page, the sliding distance of the page, the sliding distance of the page element, the distance between the first page element and the top of the page, and the distance between the next page element of the page element and the top of the page; wherein the first page element is the page element currently located at the ceiling position.
[0014] Optionally, determining whether the page element satisfies the ceiling condition includes:
[0015] If the sum of the sliding distance of the page element and the distance between the first page element and the top of the page is greater than the distance between the page element and the top of the page, and the sum of the sliding distance of the page and the distance between the first page element and the top of the page is less than the distance between the next page element of the page element and the top of the page, it is determined that the page element meets the ceiling condition;
[0016] Otherwise, it is determined that the page element does not meet the ceiling condition.
[0017] Optionally, the page element includes: an element object and a module object for displaying the content of the element object. After the step of acquiring at least one orderly arranged page element included in the page, the method further includes:
[0018] Determine the state of the module object of the page element, the state of the module object including: a folded state and an expanded state;
[0019] The distance between the page element and the top of the page is determined according to the state of the module object of the page element.
[0020] Optionally, determining the distance between the page element and the top of the page according to the state of the module object of the page element includes:
[0021] Determine whether the page element is the first page element in the acquired orderly arranged page elements, and whether the module object included in the page element is in an expanded state;
[0022] If the page element is not the first page element, and the module object included in the page element is not in the expanded state, the distance between the page element and the top of the page is determined according to the distance between the previous page element of the page element and the top of the page and the size of the previous page element along the sliding direction; wherein the previous page element is the first page element arranged before the page element;
[0023] Otherwise, the distance between the page element and the top of the page is taken as the distance between the page element and the top of the page.
[0024] Optionally, the method further comprises:
[0025] In response to an expansion operation triggered on an element object of a page element, obtaining a module object corresponding to the element object according to the expansion operation;
[0026] Displays the module object corresponding to the element object.
[0027] Optionally, before the step of determining each page element, the method further includes:
[0028] If it is detected that the state of the module object included in the page element changes, the distance between each page element and the top of the page is re-determined.
[0029] Optionally, a placeholder element is provided on one side of the ceiling position close to the top.
[0030] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for ceiling display of page elements is provided.
[0031] The device for ceiling display of page elements according to an embodiment of the present invention includes:
[0032] An acquisition module, used for acquiring at least one orderly arranged page element included in a page, wherein the order of the page elements is obtained by sorting the page elements from small to large according to the distance between the page elements and the top of the page;
[0033] The display module is used to respond to the sliding operation on the page and judge each page element. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. When the page slides and other page elements do not meet the ceiling condition, the page element remains fixed at the ceiling position; wherein, according to the positional relationship between the page element and its next page element and the ceiling position, it is determined whether the page element meets the ceiling condition, and the next page element is the first page element arranged after the page element.
[0034] To achieve the above objective, according to another aspect of an embodiment of the present invention, a terminal is provided.
[0035] The terminal of the embodiment of the present invention includes:
[0036] one or more processors;
[0037] a storage device for storing one or more programs,
[0038] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0039] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer readable medium is provided.
[0040] The computer-readable medium of the embodiment of the present invention stores a computer program, and when the program is executed by a processor, the method described above is implemented.
[0041] One embodiment of the above invention has the following advantages or beneficial effects:
[0042] In an embodiment of the present invention, when a page has at least one page element, each page element is judged. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. In this way, alternating ceiling display between multiple page elements can be achieved, that is, alternating ceiling display of multiple titles can be achieved.
[0043] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0045] Figure 1 is a flowchart of a method for displaying page elements according to a first embodiment of the present invention;
[0046] Figure 2 is a schematic diagram of a ceiling position of an embodiment of the present invention;
[0047] Figure 3 is a schematic diagram of a page element in an embodiment of the present invention when it is in a folded state;
[0048] Figure 4 is a schematic diagram of a page element in an expanded state according to an embodiment of the present invention;
[0049] Figure 5 is a flow chart of a method for displaying page elements according to a second embodiment of the present invention;
[0050] Figure 6 is a flowchart of a method for displaying page elements according to a third embodiment of the present invention;
[0051] Figure 7 is a schematic diagram of a module of a device for ceiling display of page elements according to an embodiment of the present invention;
[0052] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0053] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0055] Figure 1 is a flow chart of a method for displaying page elements according to a first embodiment of the present invention. Figure 1 As shown, the method for displaying page elements may include the following steps S101 and S102.
[0056] Step S101: obtaining at least one orderly arranged page element included in a page, wherein the order of the page elements is obtained by sorting the page elements from small to large according to the distance between the page elements and the top of the page.
[0057] In step S101, the page element can be understood as an element on the page that needs to be attached to the ceiling. The page element includes: an element object, which can be a title and other content. In order to realize the expansion or folding of the page element, the page element also includes: a module object, which is used to store the expanded content of the element object.
[0058] After step S101 and before step S102, the number of page elements can be counted, and the number of page elements can be understood as the total number of page elements. Then, it is determined whether the number of page elements is greater than 0; if the number of page elements is less than 0, it is not necessary to perform a ceiling operation on the page elements; if the number of page elements is greater than 0, it is detected whether the page is slid; if the page is slid, step S102 is executed; if the page is not slid, it is not necessary to perform a ceiling operation on the page elements.
[0059] According to the technical solution of the present invention, the top of the page can be determined according to the content layout of the page and the sliding browsing mode of the page, and can be located on any side of the page. For example: if the content layout of the page is arranged from top to bottom, and the page is browsed by sliding up and down, the top of the page is located on the upper side of the page; if the content layout of the page is arranged from left to right, and the page is browsed by sliding left and right, the top of the page is located on the left side of the page; and so on.
[0060] Step S102: In response to a sliding operation on the page, each page element is judged, and if the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page; wherein, according to the positional relationship between the page element and its next page element and the ceiling position, it is determined whether the page element meets the ceiling condition, and the next page element is the first page element arranged after the page element.
[0061] In step S102, a ceiling position is set at the top of the page, and displaying the page elements at the ceiling position of the page can be understood as ceiling display. It can be understood that when the page elements are displayed ceiling-mounted, the page elements are fixedly displayed at the ceiling position. When the page slides and other page elements do not meet the ceiling conditions, the page elements can remain fixed at the ceiling position. The ceiling position can be any position in the visible area, and the visible area refers to the area used for display. Taking a mobile phone as an example, its visible area is the mobile phone screen that displays the picture. It should be noted that Figures 2 to 4 The illustrated case is that the ceiling position is located at the top of the visual area. In addition, the ceiling position can also be set at other sides of the visual area, and the embodiment of the present invention does not specifically limit the position of the ceiling position in the visual area.
[0062] Before step S102, it can be determined whether the page element appears within the visible area; if the page element does not appear within the visible area, the ceiling operation is not performed on the page element; if the page element appears within the visible area, it is determined whether the page element meets the ceiling condition; if the page element meets the ceiling condition, step S102 is executed; if the page element does not meet the ceiling condition, the ceiling operation is not performed on the page element.
[0063] See also Figure 3 and Figure 4In order to determine whether the page element appears within the visible area, the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, the size D3 of the visible area along the sliding direction, and the sliding distance D4 of the page can be obtained (not shown in the figure). Then, based on the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, the size D3 of the visible area along the sliding direction, and the sliding distance D4 of the page, it is determined whether the page element is within the visible area of the page. This determination process needs to be performed for each page element.
[0064] Before determining whether the page element appears within the visible area of the page, the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, and the size D3 of the visible area along the sliding direction may be obtained. Then, according to the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, and the size D3 of the visible area along the sliding direction, a first parameter C1 is determined. If the sliding distance D4 of the page is greater than or equal to the first parameter C1, it is determined that the page element is within the visible area of the page; otherwise, it is determined that the page element is not within the visible area of the page.
[0065] Furthermore, the first parameter C1 can be determined by formula 1):
[0066] C1=|D1+D2-D3| 1)
[0067] Wherein, D1 is used to represent the distance between the page element and the top of the page, D2 is used to represent the size of the page element along the sliding direction, and D3 is used to represent the size of the visible area along the sliding direction. If D4 ≥ C1, it is determined that the page element is within the visible area of the page, otherwise, it is determined that the page element is not within the visible area of the page.
[0068] It can be understood that the process of solving the first parameter C1 is: add the distance D1 between the page element and the top of the page to the size D2 of the page element along the sliding direction, and then subtract the size D3 of the visible area along the sliding direction to obtain the first parameter C1.
[0069] When determining whether the page element meets the ceiling condition, a judgment process needs to be performed on each page element. Specifically, it can be determined whether the page element meets the ceiling condition based on the distance D1 between the page element and the top of the page, the sliding distance D4 of the page, the sliding distance D5 of the page element, the distance D6 between the first page element and the top of the page, and the distance D7 between the next page element of the page element and the top of the page. The first page element is the element currently located at the ceiling position.
[0070] Before determining whether the page element meets the ceiling condition, the sum of the page element sliding distance D5 and the distance D6 between the first page element and the top of the page can be used as the second parameter C2; the sum of the page sliding distance D4 and the distance D6 between the first page element and the top of the page can be used as the third parameter C3.
[0071] Then, formula 2) can be used to determine whether the page element meets the ceiling condition according to the second parameter C2 and the third parameter C3, the distance D1 between the page element and the top of the page, and the distance D7 between the next page element of the page element and the top of the page. It can be understood that when the following formula is satisfied, it is determined that the page element meets the ceiling condition, otherwise, it is determined that the page element does not meet the ceiling condition.
[0072] C2>D1 and C3 <D7 2)
[0073] Among them, the second parameter C2 is used to represent the sum of the sliding distance D5 of the page element and the distance D6 between the first page element and the top of the page; the third parameter C3 is used to represent the sum of the sliding distance D4 of the page and the distance D6 between the first page element and the top of the page; D1 is used to represent the distance between the page element and the top of the page; D7 is used to represent the distance between the next page element of the page element and the top of the page.
[0074] It can be understood that the requirements for the page element to meet the ceiling condition are: the sum of the sliding distance D5 of the page element and the distance D6 between the first page element and the top of the page is greater than the distance D1 between the page element and the top of the page, and the sum of the sliding distance D4 of the page and the distance D6 between the first page element and the top of the page is less than the distance D7 between the next page element of the page element and the top of the page.
[0075] See also Figure 4, the page elements include: page element 1 (not shown in the figure), page element 2, page element 3 and page element 4, and the elements displayed within the visible area of the page are only page element 2, page element 3 and page element 4, wherein page element 2 is located at the ceiling position, that is, page element 2 is the first page element, and page element 3 is the next page element of the first page element. In response to the sliding operation on the page, page element 3 will replace page element 2 and be displayed at the ceiling position when it meets the ceiling condition. Similarly, page element 4 will replace page element 3 and be displayed at the ceiling position when it meets the ceiling condition. Before the step of determining whether the page element appears within the visible area, it is necessary to determine the distance D1 between the page element and the top of the page. In order to facilitate the execution of the judgment process, the distance D1 between the page element and the top of the page can be stored in an array, and the distance D1 between each page element in the array and the top of the page is looped when the judgment process is executed. In addition, based on the above embodiment, in order to realize the expansion or folding of the page element, the method further includes: in response to an expansion operation triggered on an element object of the page element, obtaining a module object corresponding to the element object according to the expansion operation; and displaying the module object of the element object. It should be noted that any module object in a folded state in the visible area can be expanded and displayed through the expansion operation.
[0076] When the page element has an expanded state and a folded state, the module object state of the page element is different, and the process of determining the distance D1 between the page element and the top of the page is also different. On the basis of the above embodiment, the method also includes: first obtaining the module object of the page element, and then determining whether the page element is the first page element in the obtained orderly arranged page elements, and whether the module object corresponding to the page element is in an expanded state. If the page element is not the first page element, and the module object of the page element is not in an expanded state, the distance D1 between the page element and the top of the page is determined based on the distance between the previous page element of the page element and the top of the page and the size of the previous page element along the sliding direction. Otherwise, the distance D1 between the page element and the top of the page is the distance between the page element and the top of the page.
[0077] It is understandable that clicking the expand and close buttons of the module object can control the display or hiding of the folded content of the module object. At the same time, a variable can be set. If the server returns the variable corresponding to a page element when the page is opened, the module object of the page element is displayed; if the variable is not returned, it means that the module object of the page element is hidden. The expansion and hiding of the page element can be achieved by changing the class (style class name, which can control the element style) of the element. In order to realize the folding or expansion of the page elements, the ceiling module in the page can be made into an independent component, and then this component is introduced into the page, and the data is displayed in a loop, so that each ceiling module has its own expansion and hiding operation method without interfering with each other. Every time the user clicks on the page element, whether it is expanded or closed, the distance between each page element and the top of the page must be re-obtained.
[0078] If adopted Figure 2 In the structure shown, the page element is displayed at the ceiling position. Since the document and the ceiling position are at different levels, the user will feel abrupt during the element ceiling process. Figure 3 and Figure 4 In order to solve this problem, a placeholder element is provided on the side of the ceiling position close to the top, for example: Figure 3 and Figure 4 A placeholder element is set above the ceiling position, for example, a placeholder element is set above the ceiling position, and the placeholder element can be used to display a title box, etc.
[0079] In an embodiment of the present invention, when a page has at least one page element, each page element is judged. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. In this way, alternating ceiling display between multiple page elements can be achieved, that is, alternating ceiling display of multiple titles can be achieved.
[0080] Figure 5 is a flow chart of a method for displaying page elements according to a second embodiment of the present invention. Figure 5 As shown, the method for displaying page elements may include the following steps S501 to S505.
[0081] Step S501: Acquire at least one orderly arranged page element included in the page.
[0082] In step S501, the page element can be understood as an element on the page that needs to be attached to the ceiling, and the order of the page elements is obtained by sorting the page elements from small to large according to the distance between the page elements and the top of the page. The page element includes: an element object, and the element object can be a title and other content. In order to realize the expansion or folding of the page element, the page element also includes: a module object, and the module object is used to store the expanded content of the element object.
[0083] After step S501, the number of page elements can be counted. Then, it is determined whether the number of page elements is greater than 0; if the number of page elements is less than 0, it is not necessary to perform a ceiling operation on the page elements; if the number of page elements is greater than 0, it is detected whether the page is slid; if the page is slid, step S502 is executed; if the page is not slid, step S503 is executed, and it is not necessary to perform a ceiling operation on the page elements.
[0084] Step S502: In response to the sliding operation on the page, determine whether the page element appears within the visible area. If yes, execute step S504; otherwise, execute step S503.
[0085] In step S502, the page can be slid by gesture operation (e.g., sliding operation or dragging operation) or voice operation, and the sliding direction of the page can be Figures 2 to 4 The ceiling position can be any position in the visual area, and the visual area refers to the area used for display. It should be noted that Figure 3 to Figure 4 The illustrated case is that the ceiling position is located at the top of the visual area. In addition, the ceiling position can also be set at other sides of the visual area, and the embodiment of the present invention does not specifically limit the position of the ceiling position in the visual area.
[0086] In order to determine whether the page element appears within the visible area, the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, the size D3 of the visible area along the sliding direction, and the sliding distance D4 of the page can be obtained. Then, according to the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, the size D3 of the visible area along the sliding direction, and the sliding distance D4 of the page, it is determined whether the page element is within the visible area of the page.
[0087] It should be noted that the ceiling position may be located at a position close to one side of the page visible area, and the top of the page is the edge position of the corresponding side of the page visible area. Figure 3 and Figure 4 As shown, the ceiling suction position is set at a position close to the top.
[0088] Before determining whether the page element is within the visible area of the page, the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, and the size D3 of the visible area along the sliding direction may be obtained. Figure 3 , the position of page element 3 is the ceiling position, and page element 4 is the page element. Then, according to the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, and the size D3 of the visible area along the sliding direction, the first parameter C1 is determined. If the sliding distance D4 of the page along the sliding direction is greater than or equal to the first parameter C1, it is determined that the page element is within the visible area of the page; otherwise, it is determined that the page element is not within the visible area of the page.
[0089] Furthermore, the first parameter C1 can be determined by formula 1). If D4≥C1, it is determined that the page element is within the visible area of the page, otherwise, it is determined that the page element is not within the visible area of the page.
[0090] Step S503: If the page element does not appear within the visible area, no ceiling operation is performed on the page element.
[0091] Step S504: If the page element appears within the visible area, determine whether the page element meets the ceiling condition. If the page element meets the ceiling condition, execute step S506. If the page element does not meet the ceiling condition, execute step S503 and do not perform the ceiling operation on the page element.
[0092] In step S504, it can be determined whether the page element meets the ceiling condition according to the distance D1 between the page element and the top of the page, the sliding distance D4 of the page, the sliding distance D5 of the page element, the distance D6 between the first page element and the top of the page, and the distance D7 between the next page element of the page element and the top of the page. The first page element is the element currently located at the ceiling position.
[0093] Before determining whether the page element meets the ceiling condition, the sum of the sliding distance D5 of the page element and the distance D6 between the first page element and the top of the page can be used as the second parameter C2; the sum of the sliding distance D4 of the page and the distance D6 between the first page element and the top of the page can be used as the third parameter C3. Formula 2) can then be used to determine whether the page element meets the ceiling condition based on the second parameter C2, the third parameter C3, and the distance D7 between the next page element of the page element and the top of the page.
[0094] It can be understood that the requirement for the page element to meet the ceiling condition is that the sum of the sliding distance D5 of the page element along the sliding direction and the distance D6 between the first page element and the top of the page is greater than the distance D1 between the page element and the top of the page, and the sum of the sliding distance D4 of the page and the distance D6 between the first page element and the top of the page is less than the distance D7 between the next page element of the page element and the top of the page.
[0095] Before the step of determining whether the page element appears within the visible area, it is necessary to determine the distance D1 between the page element and the top of the page. To facilitate the determination process, the distance D1 between the page element and the top of the page can be stored in an array, and the distance D1 between each page element and the top of the page in the array is looped during the determination process.
[0096] Step S505: displaying the page element at a ceiling position of the page.
[0097] In step S505, a ceiling position is set at the top of the page, and when the page element is ceiling-mounted, the page element is fixedly displayed at the ceiling position. It is understandable that when the page slides and other page elements do not meet the ceiling-mounting condition, the page element can remain fixed at the ceiling position.
[0098] On the basis of the above embodiment, in order to realize the expansion or folding of the page element, the method further includes: in response to the expansion operation triggered on the element object of the page element, obtaining the module object corresponding to the element object according to the expansion operation; and displaying the module object of the element object. It should be noted that any module object in a folded state in the visible area can be expanded and displayed through the expansion operation.
[0099] When the page element has an expanded state and a folded state, the module object state of the page element is different, and the process of determining the distance D1 between the page element and the top of the page is also different. On the basis of the above embodiment, the method also includes: first obtaining the module object of the page element. Then determine whether the page element is the first page element in the obtained orderly arranged page elements, and whether the module object corresponding to the page element is in an expanded state. If the page element is not the first page element, and the module object of the page element is not in an expanded state, then determine the distance D1 between the page element and the top of the page based on the distance between the previous page element of the page element and the top of the page and the size of the previous page element along the sliding direction. Otherwise, the distance D1 between the page element and the top of the page is the distance between the page element and the top of the page.
[0100] It is understandable that clicking the expand and close buttons can control the display or hiding of the folded content. At the same time, a variable can be set. If the server returns the variable of a page element when the page is opened, the content in the module object corresponding to the page element will be displayed; if the variable is not returned, it means that the content in the module object of the page element is hidden. The expansion and hiding of the page elements can be achieved by changing the class (style class name, which can control the element style) of the element. In order to realize the folding or expansion of the page elements, the ceiling module in the page can be made into an independent component, and then this component is introduced into the page, and the data is displayed in a loop, so that each ceiling module has its own expansion and hiding operation method, and does not interfere with each other. Every time the user clicks on the page element, whether it is expanded or closed, the distance between each page element and the top of the page must be re-obtained.
[0101] If adopted Figure 2 In the structure shown, the page element is displayed at the ceiling position. Since the document and the ceiling position are at different levels, the user will feel abrupt during the element ceiling process. Figure 3 and Figure 4 In order to solve this problem, a placeholder element is set at the ceiling position, for example, a placeholder element is set above the ceiling position, and the placeholder element can be used to display a title box, etc.
[0102] In an embodiment of the present invention, when a page has at least one page element, each page element is judged. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. In this way, alternating ceiling display between multiple page elements can be achieved, that is, alternating ceiling display of multiple titles can be achieved.
[0103] Figure 6 is a flow chart of a method for displaying page elements according to a second embodiment of the present invention. Figure 6 As shown, the method for displaying page elements may include the following steps S601 to S616.
[0104] Step S601: After the page rendering is completed, an element object of at least one page element is obtained.
[0105] In step S601, at least one page element included in the acquired page is arranged in order, and the page element is acquired after the page data rendering is completed. The page element at least includes: an element object, and the element object can be a title and other contents.
[0106] Step S602: Obtain a module object of at least one page element.
[0107] In step S602, in order to realize the expansion or folding of the page element, the page element may further include: a module object, and the module object includes: the expanded content of the element object. It is understandable that if there is no folding effect, there is no need to expand or collapse the module object related content.
[0108] Step S603: Count the number of page elements;
[0109] In step S603, the number of page elements can be understood as the total number of page elements.
[0110] Step S604: Determine whether the number of the page elements is greater than 0; if the number of the page elements is greater than 0, execute step S606; otherwise, execute step S605.
[0111] Step S605: Do not perform the ceiling suction operation.
[0112] In step S605: when the total number of page elements is less than 0, it means there is no page element and the ceiling operation is not performed.
[0113] Step S606: In response to the sliding operation on the page, determine whether each of the page elements is the first page element in the acquired orderly arranged page elements and whether the module object corresponding to the page element is in an expanded state. If so, execute step S607; otherwise, execute step S608.
[0114] Step S607: If the page element is the first page element or the module object corresponding to the page element is in an expanded state, the distance D1 between the page element and the top of the page is the distance between the element object itself and the top of the page.
[0115] Since the first page element originally occupies a ceiling position, the first page element can be excluded by determining whether the page element is the first page element.
[0116] Step S608: If the page element is not the first page element and the module object of the page element is not in the expanded state, determine the distance D1 between the page element and the top of the page based on the distance between the previous page element of the page element and the top of the page and the size of the previous page element along the sliding direction.
[0117] If the page element is not the first page element and the module object corresponding to the page element is not in the expanded state, the height of the previous page element from the top and the height of the previous page element from itself are taken as the height of the page element from the top. If the page element is the first page element or the module object corresponding to the page element is in the expanded state, the height of the target from the top is the height of itself from the top.
[0118] Step S609: storing the distance D1 between the page element and the top of the page into an array;
[0119] In step S609, Figures 2 to 4 Taking the structure shown as an example, after obtaining the height of each required page element from the top, it is stored in an array list.
[0120] Step S610: Detecting whether the page is slid. Through step S610, scroll monitoring can be performed on the page. If it is detected whether the page is slid, step S611 is executed.
[0121] Step S611: Obtain the sliding distance D4 of the page.
[0122] Step S612: Loop the array.
[0123] Step S613: determine whether the page element is within the visible area of the page; if so, execute step S614, otherwise terminate the process.
[0124] In step S613, in order to determine whether the page element appears within the visible area, the array list is looped to obtain the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, the size D3 of the visible area along the sliding direction, and the sliding distance D4 of the page. Then, according to the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, the size D3 of the visible area along the sliding direction, and the sliding distance D4 of the page, it is determined whether the page element is within the visible area of the page.
[0125] It should be noted that the ceiling position may be located at a side position close to the visible area of the page. Figure 3 and Figure 4 As shown, the ceiling suction position is set at a position close to the top.
[0126] Before determining whether the page element is within the visible area of the page, the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, and the size D3 of the visible area along the sliding direction may be obtained. Figure 3, the position of page element 3 is the ceiling position, and page element 4 is the next page element of page element 3. Then, according to the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, and the size D3 of the visible area along the sliding direction, the first parameter C1 is determined. If the sliding distance D4 of the page is greater than or equal to the first parameter C1, it is determined that the page element is within the visible area of the page; otherwise, it is determined that the page element is not within the visible area of the page. Further, the first parameter C1 can be determined by formula 1). If D4≥C1, it is determined that the page element is within the visible area of the page; otherwise, it is determined that the page element is not within the visible area of the page.
[0127] Step S614: Determine whether the page element meets the ceiling condition; if so, execute step S615; otherwise, execute step S616.
[0128] In step S614, it can be determined whether the page element meets the ceiling condition based on the distance D1 between the page element and the top of the page, the sliding distance D4 of the page along the sliding direction, the sliding distance D5 of the page element along the sliding direction, the distance D6 between the first page element and the top of the page, and the distance D7 between the next page element of the page element and the top of the page. The first page element is the element currently located at the ceiling position. The next page element of the page element is the adjacent element of the page element away from the side of the ceiling position. The next page element of the page element can also be understood as the next page element.
[0129] Before determining whether the page element meets the ceiling condition, the sum of the sliding distance D5 of the page element and the distance D6 between the first page element and the top of the page can be used as the second parameter C2; the sum of the sliding distance D4 of the page and the distance D6 between the first page element and the top of the page can be used as the third parameter C3.
[0130] Then, formula 2) can be used to determine whether the page element meets the ceiling condition based on the second parameter C2 and the third parameter C3, the distance D1 between the page element and the top of the page, and the distance D7 between the next page element of the page element and the top of the page.
[0131] It can be understood that the requirements for the page element to meet the ceiling condition are: the sum of the sliding distance D5 of the page element and the distance D6 between the first page element and the top of the page is greater than the distance D1 between the page element and the top of the page, and the sum of the sliding distance D4 of the page and the distance D6 between the first page element and the top of the page is less than the distance D7 between the next page element of the page element and the top of the page.
[0132] Before the step of determining whether the page element appears within the visible area or before the step of determining whether the page element satisfies the ceiling condition, it is necessary to determine the distance D1 between the page element and the top of the page. To facilitate the determination process, the distance D1 between the page element and the top of the page can be stored in an array, and the distance D1 between each page element and the top of the page in the array is looped during the determination process.
[0133] Step S615: displaying the page element at a ceiling position.
[0134] In step S615, ceiling display can be understood as displaying the page element at the ceiling position of the page. It can be understood that when the page element is displayed on the ceiling, the page element is fixedly displayed at the ceiling position. When the page slides and other page elements do not meet the ceiling condition, the page element can remain fixed at the ceiling position.
[0135] Step S616: Do not display the page elements on the ceiling.
[0136] On the basis of the above embodiment, in order to realize the expansion or folding of the page element, the method further includes: in response to the expansion operation triggered on the element object of the page element, obtaining the module object corresponding to the element object according to the expansion operation; and displaying the module object of the element object. It should be noted that any module object in a folded state in the visible area can be expanded and displayed through the expansion operation.
[0137] When the page element has an expanded state and a folded state, the module object state of the page element is different, and the process of determining the distance D1 between the page element and the top of the page is also different. On the basis of the above embodiment, the method also includes: first obtaining the module object of the page element, and then determining whether the page element is the first page element in the obtained orderly arranged page elements, and whether the module object corresponding to the page element is in an expanded state. If the page element is not the first page element, and the module object of the page element is not in an expanded state, the distance D1 between the page element and the top of the page is determined based on the distance between the previous page element of the page element and the top of the page and the size of the previous page element along the sliding direction. Otherwise, the distance D1 between the page element and the top of the page is the distance between the page element and the top of the page.
[0138] In an embodiment of the present invention, when a page has at least one page element, each page element is judged. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. In this way, alternating ceiling display between multiple page elements can be achieved, that is, alternating ceiling display of multiple titles can be achieved.
[0139] Furthermore, the page element display method of the embodiment of the present invention can also realize the folding or unfolding of the page elements. When the page element is in the expanded state, the content in the module object can be displayed, that is, the accordion effect display of multiple content modules with titles scrolling alternately on the ceiling can be realized, which is more convenient for user operation and use.
[0140] Figure 7 is a schematic diagram of a module of a device for ceiling display of page elements according to an embodiment of the present invention, see Figure 7 The device 700 for displaying page elements on the ceiling includes:
[0141] An acquisition module 701 is used to acquire at least one orderly arranged page element included in a page, wherein the order of the page elements is obtained by sorting the page elements from small to large according to the distance between the page elements and the top of the page;
[0142] The display module 702 is used to respond to the sliding operation on the page and judge each page element. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. When the page slides and other page elements do not meet the ceiling condition, the page element remains fixed at the ceiling position; wherein, whether the page element meets the ceiling condition is determined based on the positional relationship between the page element and its next page element and the ceiling position, and the next page element is the first page element arranged after the page element.
[0143] Optionally, the display module 702 is further used for:
[0144] For each page element, if the sliding distance D4 of the page is greater than or equal to the first parameter, it is determined that the page element is within the visible area of the page;
[0145] Otherwise, it is determined that the page element does not appear within the visible area of the page;
[0146] The first parameter is calculated based on the distance D1 between the page element and the top of the page, the size D2 of the page element along the sliding direction, and the size D3 of the visible area along the sliding direction.
[0147] Optionally, the display module 702 is further used for:
[0148] For each page element, determine whether the page element meets the ceiling condition based on the distance D1 between the page element and the top of the page, the sliding distance D4 of the page, the sliding distance D5 of the page element, the distance D6 between the first page element and the top of the page, and the distance D7 between the next page element of the page element and the top of the page; wherein the first page element is the page element currently located at the ceiling position.
[0149] Optionally, the display module 702 is further used for:
[0150] If the sum of the sliding distance D5 of the page element and the distance D6 between the first page element and the top of the page is greater than the distance D1 between the page element and the top of the page, and the sum of the sliding distance D4 of the page and the distance D6 between the first page element and the top of the page is less than the distance D7 between the next page element of the page element and the top of the page, it is determined that the page element meets the ceiling suction condition;
[0151] Otherwise, it is determined that the page element does not meet the ceiling condition.
[0152] Optionally, the apparatus 700 for displaying page elements on the ceiling further includes:
[0153] A first determining module is used to determine the state of the module object of the page element, where the state of the module object includes: a folded state and an expanded state;
[0154] The second determining module is used to determine the distance D1 between the page element and the top of the page according to the state of the module object of the page element.
[0155] Optionally, the second determining module is further configured to:
[0156] Determine whether the page element is the first page element in the acquired orderly arranged page elements, and whether the module object included in the page element is in an expanded state;
[0157] If the page element is not the first page element, and the module object included in the page element is not in the expanded state, the distance D1 between the page element and the top of the page is determined according to the distance between the previous page element of the page element and the top of the page and the size of the previous page element along the sliding direction; wherein the previous page element is the first page element arranged before the page element;
[0158] Otherwise, the distance between the page element and the top of the page is taken as the distance D1 between the page element and the top of the page.
[0159] Optionally, the apparatus 700 for displaying page elements on the ceiling further includes:
[0160] An operation module, configured to respond to an expansion operation triggered on an element object of a page element and obtain a module object corresponding to the element object according to the expansion operation;
[0161] The second display module is used to display the module object corresponding to the element object.
[0162] Optionally, the apparatus 700 for displaying page elements on the ceiling further includes:
[0163] The third determination module is used to redetermine the distance between each page element and the top of the page if it is detected that the state of the module object included in the page element has changed.
[0164] Optionally, a placeholder element is provided on one side of the ceiling position close to the top.
[0165] In an embodiment of the present invention, when a page has at least one page element, each page element is judged. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. In this way, alternating ceiling display between multiple page elements can be achieved, that is, alternating ceiling display of multiple titles can be achieved.
[0166] Figure 8 An exemplary system architecture 800 is shown to which the element ceiling display method or the device for ceiling display of page elements according to the embodiments of the present invention may be applied.
[0167] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0168] Users can use terminal devices 801, 802, and 803 to interact with server 805 through network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0169] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0170] The server 805 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 801, 802, and 803. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0171] It should be noted that the element ceiling display method provided in the embodiment of the present invention is generally executed by the terminal devices 801 , 802 , and 803 . Accordingly, the device for displaying page elements ceiling display is generally arranged in the terminal devices 801 , 802 , and 803 .
[0172] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0173] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0174] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0175] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.
[0176] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present invention are executed.
[0177] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0178] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0179] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining at least one orderly arranged page element included in the page, and the order of the page elements is obtained by sorting from small to large according to the distance between the page element and the top of the page; in response to the sliding operation on the page, each page element is judged, and if the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page, and when the page slides and other page elements do not meet the ceiling condition, the page element can be kept fixed at the ceiling position; wherein, according to the positional relationship between the page element and its next page element and the ceiling position, it is determined whether the page element meets the ceiling condition, and the next page element is the first page element arranged after the page element.
[0180] In an embodiment of the present invention, when a page has at least one page element, each page element is judged. If the page element is located within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page. In this way, alternating ceiling display between multiple page elements can be achieved, that is, alternating ceiling display of multiple titles can be achieved.
[0181] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for displaying page elements, characterized in that: include: Acquire at least one orderly arranged page element included in the page, wherein the order of the page elements is obtained by sorting the page elements from small to large according to the distance between the page elements and the top of the page; In response to a sliding operation on the page, each page element is judged, and if the page element is within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page, and when the page slides and other page elements do not meet the ceiling condition, the page element remains fixed at the ceiling position; wherein, according to the positional relationship between the page element and its next page element and the ceiling position, it is determined whether the page element meets the ceiling condition, and the next page element is the first page element arranged after the page element; Determining whether the page element satisfies the ceiling condition based on the positional relationship between the page element and its next page element and the ceiling position includes: for each page element, if the sum of a sliding distance of the page element and a distance between a first page element and the top of the page is greater than the distance between the page element and the top of the page, and the sum of a sliding distance of the page and a distance between the first page element and the top of the page is less than a distance between the next page element of the page element and the top of the page, then determining that the page element satisfies the ceiling condition; otherwise, determining that the page element does not satisfy the ceiling condition; wherein the first page element is the page element currently located at the ceiling position.
2. The method according to claim 1, characterized in that: The determination of each page element includes: For each page element, if the sliding distance of the page is greater than or equal to the first parameter, it is determined that the page element is within the visible area of the page; Otherwise, it is determined that the page element does not appear within the visible area of the page; The first parameter is calculated based on the distance between the page element and the top of the page, the size of the page element along the sliding direction, and the size of the visible area along the sliding direction.
3. The method according to claim 1, characterized in that The page element includes: an element object and a module object for displaying the content of the element object. After the step of acquiring at least one orderly arranged page element included in the page, the method further includes: Determine the state of the module object of the page element, the state of the module object including: a folded state and an expanded state; The distance between the page element and the top of the page is determined according to the state of the module object of the page element.
4. The method according to claim 3, characterized in that Determining the distance between the page element and the top of the page according to the state of the module object of the page element includes: Determine whether the page element is the first page element in the acquired orderly arranged page elements, and whether the module object included in the page element is in an expanded state; If the page element is not the first page element, and the module object included in the page element is not in the expanded state, the distance between the page element and the top of the page is determined according to the distance between the previous page element of the page element and the top of the page and the size of the previous page element along the sliding direction; wherein the previous page element is the first page element arranged before the page element; Otherwise, the distance between the page element itself and the top of the page is taken as the distance between the page element and the top of the page.
5. The method according to claim 3, characterized in that: The method further comprises: In response to an expansion operation triggered on an element object of a page element, obtaining a module object corresponding to the element object according to the expansion operation; Displays the module object corresponding to the element object.
6. The method according to claim 3, characterized in that Before the step of determining each page element, it also includes: If it is detected that the state of the module object included in the page element changes, the distance between each page element and the top of the page is re-determined.
7. The method according to claim 1, characterized in that A placeholder element is arranged on one side of the ceiling position close to the top.
8. A device for ceiling display of page elements, characterized in that: include: An acquisition module, used for acquiring at least one orderly arranged page element included in a page, wherein the order of the page elements is obtained by sorting the page elements from small to large according to the distance between the page elements and the top of the page; A display module is used to judge each page element in response to a sliding operation on the page, and if the page element is within the visible area and meets the ceiling condition, the page element is displayed at the ceiling position of the page, and when the page slides and other page elements do not meet the ceiling condition, the page element remains fixed at the ceiling position; wherein, according to the positional relationship between the page element and its next page element and the ceiling position, it is determined whether the page element meets the ceiling condition, and the next page element is the first page element arranged after the page element; Determining whether the page element satisfies the ceiling condition based on the positional relationship between the page element and its next page element and the ceiling position includes: for each page element, if the sum of a sliding distance of the page element and a distance between a first page element and the top of the page is greater than the distance between the page element and the top of the page, and the sum of a sliding distance of the page and a distance between the first page element and the top of the page is less than a distance between the next page element of the page element and the top of the page, then determining that the page element satisfies the ceiling condition; otherwise, determining that the page element does not satisfy the ceiling condition; wherein the first page element is the page element currently located at the ceiling position.
9. A terminal, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
