Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Fig. 1 shows a block diagram of a user terminal 100 applicable to an embodiment of the present invention. As shown in fig. 1, the user terminal 100 includes a memory 101, a memory controller 102, one or more (only one shown) processors 103, a peripheral interface 104, a radio frequency module 105, an audio module 106, a touch screen 107, and the like. These components communicate with each other via one or more communication buses/signal lines 108.
The memory 101 may be used to store software programs and modules, such as program instructions/modules corresponding to the page switching processing method and apparatus in the embodiments of the present invention, and the processor 103 executes various functional applications and data processing, such as the page switching processing method provided in the embodiments of the present invention, by running the software programs and modules stored in the memory 101.
Memory 101 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. Access to the memory 101 by the processor 103 and possibly other components may be under the control of the memory controller 102.
The peripheral interface 104 couples various input/output devices to the processor 103 as well as to the memory 101. In some embodiments, the peripheral interface 104, the processor 103, and the memory controller 102 may be implemented in a single chip. In other examples, they may be implemented separately from the individual chips.
The rf module 105 is used for receiving and transmitting electromagnetic waves, and implementing interconversion between the electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices.
Audio module 106 provides an audio interface to a user that may include one or more microphones, one or more speakers, and audio circuitry.
The touch screen 107 provides both an output and an input interface between the user terminal 100 and the user. In particular, the touch screen 107 displays video output to the user, the content of which may include text, graphics, video, and any combination thereof.
It is to be understood that the structure shown in fig. 1 is merely illustrative, and that the user terminal 100 may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
In the embodiment of the present invention, the user terminal 100 is installed with a client, which may be a browser or a third-party application, and corresponds to a Server (Server) end, and provides a service, such as an e-book reading service, for playing a local document or an e-book for a user.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
First embodiment
Referring to fig. 2, fig. 2 is a flowchart of a page switching processing method according to a first embodiment of the present invention, where the method specifically includes the following steps:
step S110: and acquiring a page switching instruction triggered by a page switching button in the current page.
Referring to fig. 3, when a user browses a page, if page switching is required, for example, switching to a previous page or a next page, or skipping, the page switching may be performed by clicking a page switching button in the page, and the user terminal may obtain a page switching instruction triggered by the page switching button in a current page by the user, where the current page is a page currently browsed by the user.
Step S120: acquiring first position information of the page switching button in a current display area of the current page and a rolling distance of a scroll bar in the current page when the page switching button is triggered.
When a user clicks a page switching button in a current page to switch the page, a user terminal acquires first position information of a current display area of the page switching button in the current page when the page switching button is triggered by the user, wherein the current display area can be understood as an interface area which can be seen by the user in the current page. As a mode, the first position information includes a distance between a page switching button in the current page and a first side of a current display area in the current page and a distance between the page switching button in the current page and a second side of the current display area in the current page, where the first side is connected to the second side.
The first position information may be represented as pos1, and may be obtained through pos1 ═ domelement.getboudoundingclientrect (), a distance between the page switching button and a first side of the current display area in the current page may be represented as pos1.left, and a distance between the page switching button and a second side of the current display area in the current page may be represented as pos1. top. In the practical application process, if the page switch button is regarded as a rectangular element, the rectangular element includes four attributes: left, top, righr and bottom, which respectively represent the distance between each side of the rectangular element and two connected sides of the current display area, if the first side is the left side of the current display area in fig. 3, and the second side is the top side of the current display area in fig. 3, after the rectangular element is obtained through a var box ═ document.getelementbyid ('box'), pos1.left can be obtained through alert (box.getboudoundclentrect () left), which represents the distance between the left side of the rectangular element and the left side of the current display area; pos1.top can be obtained by alert (box) indicating the distance between the top side of the rectangular element and the top side of the current display area, so that the first position information of the current display area in the current page when the page switching button is triggered can be obtained by obtaining the distance between the page switching button and the two connected side edges of the current display area in the current page.
When a user triggers a page switching button, the user terminal also needs to acquire a scrolling distance of a scroll bar in a current page, wherein the scrolling distance includes a scrolling distance of the scroll bar in the current page in the horizontal direction of the page when the page switching button is triggered and a scrolling distance of the scroll bar in the current page in the vertical direction of the page when the page switching button is triggered. The scroll distance of the scroll bar in the current page in the horizontal direction of the page when the page switching button is triggered can be obtained through windows scroll xstart ═ document.
Step S130: and switching the current page to a target page according to the page switching instruction.
When the page switching instruction that the user triggers my page switching through the page switching button in the current page is obtained, the user terminal switches the current page to the target page according to the page switching instruction, namely, switching between an upper page and a lower page from the current page or switching between page jumps.
Step S140: and acquiring second position information of a page switching button of a current display area in the target page.
After the page switching is completed, the current display page is a target page, and second position information of a page switching button of a current display area in the target page is acquired, where the second position information includes a distance between the page switching button in the target page and a first side of the current display area in the target page and a distance between the page switching button in the target page and a second side of the current display area in the target page, where the first side is connected to the second side, and the second position information acquisition method refers to the first position information acquisition method in step S120, and is not described herein again for brevity of description.
Step S150: and adjusting the rolling distance of a rolling bar in the target page according to the first position information, the second position information and the rolling distance so as to enable the position of a page switching button of the current display area in the current page to be the same as the position of a page switching button of the current display area in the target page.
Through the steps, the first position information of the current display area of the page switching button in the current page, the second position information of the current display area of the page switching button in the target page, and the rolling distance of the scroll bar when the page switching button in the current page is triggered are obtained, and in order to realize that the position of the page switching button is not changed before and after switching, the rolling distance of the scroll bar in the target page needs to be adjusted, so that the positions of the page switching button in the current display area in the current page and the page switching button in the current display area in the target page are the same, as shown in fig. 3 and 4.
Wherein, the scrolling distance of the scroll bar in the target page in the page horizontal direction is adjusted according to the distance between the page switching button in the target page and the first side edge of the current display area in the target page and the difference between the distance between the page switching button in the current page and the first side edge of the current display area in the current page, that is, the scroll distance of the scroll bar in the target page in the horizontal direction of the page may be represented as document, document element, scroll left ═ windows scroll xstart + (pos2. left-pos 1.left), pos1.left is represented as the distance between the page switch button of the current display area in the current page and the first side of the current display area, the first side may be the left side of the current display area in the current page, pos2.left is represented as the distance between the page switch button of the current display area in the target page and the first side of the current display area, and the first side may be the left side of the current display area in the target page.
Adjusting the scrolling distance of the scroll bar in the target page in the page vertical direction according to the distance between the page switching button in the target page and the second side of the current display area in the target page and the difference between the distance between the page switching button in the current page and the second side of the current display area in the current page, that is, the scrolling distance of the scroll bar in the target page in the vertical direction of the page may be represented as document, document element, scroll top ═ windows scroll start + (pos2. top-pos 1.top), pos1.top is represented as the distance between the page switch button of the current display area in the current page and the first side of the current display area, the first side may be the top side of the current display area in the current page, pos2.top is represented as the distance between the page switch button of the current display area in the target page and the first side of the current display area, and the first side may be the first side of the current display area in the target page.
In the page switching processing method provided by the first embodiment of the present invention, after the current page is switched to the target page, the scrolling distance of the scroll bar in the target page is adjusted, so that the positions of the page switching button in the current display area in the current page and the page switching button in the current display area in the target page are the same, that is, the position of the page switching button is not changed, and the position of the page switching button relative to the finger of the user is not changed, so that the user does not need to move the finger when switching the page, and the convenience of the user in performing the page switching operation is improved.
Second embodiment
Referring to fig. 5, fig. 5 is a flowchart of a page switching processing method according to a second embodiment of the present invention, where the method specifically includes the following steps:
step S210: and acquiring a switching instruction triggered by a page switching button in the page.
Referring to fig. 6, when a user browses a page, if a page needs to be turned or skipped, the page can be switched by clicking a page switching button in the page, and the user terminal can obtain a page switching instruction triggered by the page switching button in the page by the user.
Step S220: acquiring first position information of the page switching button in a current display area of the page and a rolling distance of a scroll bar in the page when the page switching button is triggered.
The specific implementation manner of this step is the same as the specific implementation manner in step S120, and for brevity of description, please refer to the specific implementation manner in step S120, which is not described herein again.
Step S230: and updating the content of the corresponding display area in the page according to the switching instruction.
After the user terminal obtains the switching instruction, the content of the corresponding display area in the page may be updated according to the switching instruction, that is, the content of a certain area in the page is updated, for example, the content of a certain area in the page may be turned up or down or skipped by triggering the page switching button, such as updating the content shown in the content bar in fig. 6.
Step S240: and acquiring second position information of the page switching button of the current display area in the page after the content of the display area is updated.
After the content of the display area in the page is updated, the second position information of the page switching button in the updated page is acquired, the acquiring method of the second position information is consistent with the acquiring method of the first position information of the page switching button before the page is updated, and the specific implementation process of the method may refer to the specific description in step S120.
Step S250: and adjusting the scroll distance of a scroll bar in the page after switching according to the first position information, the second position information and the scroll distance so as to enable the position of a page switching button of the current display area in the page before switching to be the same as the position of a page switching button of the current display area in the page after switching.
The first position information of the page switching button of the page before switching, the second position information of the page switching button after switching, and the rolling distance of the scroll bar in the page when the page switching button is triggered are obtained through the above steps, and in order to realize that the position of the page switching button does not change before and after switching, the rolling distance of the scroll bar in the page after switching needs to be adjusted, so that the position of the page switching button in the current display area in the page before switching is the same as the position of the page switching button in the current display area in the page after switching, as shown in fig. 6 and 7.
The specific implementation manner of this step can refer to the specific description of step S150, which is not described herein in too much detail.
In the page switching processing method provided by the second embodiment of the present invention, the content of the corresponding display area in the page is updated by triggering the page switching button in the page, and the position of the page switching button in the current display area in the page before switching is the same as the position of the page switching button in the current display area in the page after switching by adjusting the scrolling distance of the scroll bar in the page after switching, that is, the position of the page switching button does not change, so that the position of the page switching button relative to the finger of the user does not change, and thus the user does not need to move the finger when switching, and the convenience of the user in performing the page switching operation is improved.
Third embodiment
Referring to fig. 8, fig. 8 is a block diagram of a page switching processing apparatus 200 according to a third embodiment of the present invention, configured to execute the page switching processing method according to the first embodiment, where the apparatus specifically includes:
the first obtaining module 210 is configured to obtain a page switching instruction triggered by a page switching button in a current page.
A second obtaining module 220, configured to obtain first position information of a current display area of the page switching button in the current page when the page switching button is triggered, and a scroll distance of a scroll bar in the current page.
A switching module 230, configured to switch the current page to a target page according to the page switching instruction.
A third obtaining module 240, configured to obtain second position information of the page switching button in the current display area of the target page in the target page.
A first adjusting module 250, configured to adjust a scrolling distance of a scroll bar in the target page according to the first position information, the second position information, and the scrolling distance, so that a position of a page switching button in a current display area in the current page is the same as a position of a page switching button in the current display area in the target page.
As an embodiment, the second obtaining module 220 includes: a first rolling distance acquisition submodule and a second rolling distance acquisition submodule.
And the first rolling distance acquisition submodule is used for acquiring the rolling distance of a scroll bar in the current page in the horizontal direction of the page when the page switching button is triggered.
And the second rolling distance acquisition submodule is used for acquiring the rolling distance of the scroll bar in the current page in the vertical direction of the page when the page switching button is triggered.
The first adjusting module 250 includes: a first scroll distance adjustment submodule and a second scroll distance adjustment submodule.
And the first rolling distance adjusting submodule is used for adjusting the rolling distance of the scroll bar in the target page in the page horizontal direction according to the difference between the distance between the page switching button in the target page and the first side edge of the current display area in the target page and the distance between the page switching button in the current page and the first side edge of the current display area in the current page.
And the second rolling distance adjusting submodule is used for adjusting the rolling distance of the scroll bar in the target page in the page vertical direction according to the difference between the distance between the page switching button in the target page and the second side edge of the current display area in the target page and the distance between the page switching button in the current page and the second side edge of the current display area in the current page.
In addition, the first position information includes a distance between a page switching button in the current page and a first side of a current display area in the current page and a distance between the page switching button in the current page and a second side of the current display area in the current page, where the first side is connected to the second side.
The second position information comprises a distance between a page switching button in the target page and a first side edge of a current display area in the target page and a distance between the page switching button in the target page and a second side edge of the current display area in the target page, wherein the first side edge is connected with the second side edge.
Fourth embodiment
Referring to fig. 9, fig. 9 is a block diagram of a page switching processing apparatus 300 according to a fourth embodiment of the present invention, configured to execute the page switching processing method according to the second embodiment, where the apparatus specifically includes:
a fourth obtaining module 310, configured to obtain a switching instruction triggered by a page switching button in a page.
A fifth obtaining module 320, configured to obtain first position information of a current display area of the page switching button in the page when the page switching button is triggered, and a scroll distance of a scroll bar in the page.
An updating module 330, configured to update the content of the corresponding display area in the page according to the switching instruction.
A sixth obtaining module 340, configured to obtain second position information of the page switching button in the current display area in the page after the content of the display area is updated.
A second adjusting module 350, configured to adjust a scrolling distance of a scrolling bar in the page after switching according to the first position information, the second position information, and the scrolling distance, so that a page switching button in a current display area of the page before switching is located at the same position as a page switching button in the current display area of the page after switching.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method, and will not be described in too much detail herein.
To sum up, embodiments of the present invention provide a page switching processing method, an apparatus, a user terminal, and a readable storage medium, where a page switching instruction triggered by a page switching button in a current page is first obtained, first position information of a current display area of the page switching button in the current page and a rolling distance of a scroll bar in the current page when the page switching button is triggered are then obtained, the current page is then switched to a target page according to the page switching instruction, and second position information of the page switching button in the current display area in the target page is then obtained, so that the rolling distance of the scroll bar in the target page is adjusted according to the first position information, the second position information, and the rolling distance, so that a page switching button in the current display area in the current page and a page switching button in the current display area in the target page are enabled to have different scrolling distances from each other The position is the same, namely the position of the page switching button can not be changed, so that the position of the page switching button relative to the finger of the user can not be changed, the user can not move the finger when switching the page, and the convenience of the user in page switching operation is improved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.