Full-screen carousel control method and device based on jQuery

By optimizing image processing and loading strategies, responsive design and improvements to browser compatibility, accessibility and animation effects, multiple problems with jQuery full-screen carousels are solved and user experience and performance are improved.

CN118466807BActive Publication Date: 2024-10-01ONE NETWORK INTEROPERABILITY (BEIJING) TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410916782.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-10-01
Estimated Expiration
2044-07-10

AI Technical Summary

Technical Problem

The existing jQuery full-screen carousel has many problems in terms of performance, responsive design, browser compatibility, touch event support, accessibility, SEO impact, and code maintenance, resulting in degraded user experience and poor performance.

Method used

Optimize image processing and loading strategies by obtaining image characteristics and loading environment performance evaluation, use CSS3 and HTML5 for responsive design and browser compatibility optimization, utilize ARIA standards to improve accessibility, pre-render static content and use CSS3 hardware-accelerated animations Effect to achieve optimization of animation effects.

Benefits of technology

It improves the loading performance and user experience of jQuery full-screen carousel, solves the problems of performance, responsive design, browser compatibility, touch event support, accessibility and SEO impact, and simplifies code maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118466807B_ABST
    Figure CN118466807B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a jQuery-based full-screen carousel control method, device and electronic device, which belongs to the field of image processing technology. The method includes: obtaining n images that need to be full-screen carousel to form a carousel image set, extracting features from each image in the carousel image set P to obtain an image feature set; performing performance evaluation on the loading environment of the full-screen carousel to obtain a loading performance vector; optimizing and calculating each image in the carousel image set P based on the loading performance vector M and the image feature set K to obtain an optimization parameter set; adding a class name Lm and a data attribute Dpr to the images in the first carousel image set Pf in the HTML of the page where the full-screen carousel is located; after the first carousel image set Pf is loaded, loading the second carousel optimized image set Psh on the page where the full-screen carousel is located. This solution can improve the loading efficiency and user experience of the full-screen carousel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method, device and electronic device for controlling a full-screen carousel image based on jQuery. Background Art

[0002] A full-screen carousel is a design element widely used on web pages or application interfaces. It usually occupies most of the entire screen or viewport and switches between multiple images or content automatically or manually.

[0003] The images or content of a full-screen carousel occupy most of the screen or viewport, making it immediately noticeable to users as soon as they enter the page. Full-screen carousels usually have an autoplay function, and the images or content will automatically switch at a set time interval. Users can also manually control the switching of images by clicking, sliding, or touching the screen. Full-screen carousels can add various interactive effects, such as animation transitions, click events, etc., to enhance the user experience.

[0004] Full-screen carousels are widely used in e-commerce websites, news applications, corporate websites, and other scenarios. They can effectively attract users' attention and convey information. However, excessive use or improper design of full-screen carousels may also lead to a decline in user experience.

[0005] In the process of designing and developing full-screen carousel images, the existing technology has the following problems:

[0006] 1. Performance issues:

[0007] When the carousel contains a large number of high-resolution images, the loading time may be longer, causing the page to load more slowly and affecting the user experience.

[0008] 2. Responsive design is not enough:

[0009] Many jQuery slideshow plugins may not perform well on mobile devices and may not adapt well to different screen sizes, resulting in a messy layout or invisible content.

[0010] 3. Browser compatibility issues:

[0011] Some older versions of browsers do not fully support jQuery and its plug-ins, which may cause compatibility issues and affect the normal display and operation of the carousel.

[0012] 4. Incomplete support for touch events:

[0013] On mobile devices, support for touch events is often poor, and user swipe or touch operations may not respond well or may not work at all.

[0014] 5. Lack of accessibility:

[0015] Many jQuery carousels lack adequate consideration for accessibility and support for assistive tools such as screen readers, and are unable to meet the needs of users with disabilities.

[0016] 6. SEO Impact:

[0017] If the content in the carousel is dynamically loaded via JavaScript, search engine crawlers may not be able to capture the content, thus affecting SEO results.

[0018] 7. Difficult code maintenance:

[0019] Complex jQuery code and plugin integration can make code maintenance difficult, especially when the project is large or requires frequent updates.

[0020] 8. Animation effects are stuck:

[0021] Since jQuery mainly relies on JavaScript for animation processing, when there are many or frequent animation effects, it may cause page freezes and poor user experience.

[0022] The above problems become technical problems that need to be solved. Summary of the invention

[0023] In view of this, the embodiments of the present invention provide a jQuery-based full-screen carousel control method, device and electronic device, which at least partially solve the problems existing in the prior art.

[0024] In a first aspect, an embodiment of the present invention provides a method for controlling a full-screen slideshow based on jQuery, comprising:

[0025] Obtain n images that need to be displayed in full-screen carousel to form a carousel image set P={P1, P2, ..., Pn}, perform feature extraction on each image in the carousel image set P to obtain an image feature set K={K1, K2, ..., Kn};

[0026] The loading environment of the full-screen slideshow is evaluated to obtain a loading performance vector M=[PLT, TTFB, LCP, RI], where PLT represents the page loading time of the page where the full-screen slideshow is located, TTFB represents the first content rendering time of the page where the full-screen slideshow is located, LCP represents the maximum content drawing time of the page where the full-screen slideshow is located, and RI represents the response index of the page where the full-screen slideshow is located.

[0027] Based on the loading performance vector M and the image feature set K, each image in the carousel image set P is optimized and calculated to obtain an optimization parameter set Y={Y1, Y2, ...Yn}, where Yi represents the optimization parameter for the i-th image in the carousel image set P. Based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf={Pf1, Pf2, ...Pfq} and a second carousel image set Ps={Ps1, Ps2, ...Psk}, where the sum of q and k is equal to n;

[0028] In the HTML of the page where the full-screen slideshow image is located, add the class name Lm and the data attribute Dpr to the images in the first slideshow image set Pf, and construct a ternary loading data set Syj={Lm, Dpr, URL} by combining the class name Lm, the data attribute Dpr, and the URL of the image in the first slideshow image set. The ternary loading data set Syj is used to load the images in the first slideshow image set Pf on the page where the full-screen slideshow image is located.

[0029] In the jQuery statement of the page where the full-screen carousel image is located, a loading instance is set for the second carousel image set, and the loading instance includes a callback function and a configuration object. The callback function starts when the ternary loading data set is called. A loading threshold is set inside the configuration object. When the image loading ratio in the first carousel image set exceeds the loading threshold, the configuration object uses the image processing function G contained inside to perform image optimization processing on the images in the second carousel image set Ps according to the optimization parameter set Y to form a second carousel optimized image set Psh. The second carousel optimized image set Psh is loaded on the page where the full-screen carousel image is located after the first carousel image set Pf is loaded.

[0030] According to a specific implementation of the embodiment of the present disclosure, the step of acquiring n images that need to be displayed in full-screen carousel to form a carousel image set P={P1, P2, ..., Pn}, and performing feature extraction on each image in the carousel image set P to obtain an image feature set K={K1, K2, ..., Kn} includes:

[0031] Use a filter to smooth an image:

[0032]

[0033] in, is the original image, is the Gaussian kernel function, represents the convolution operation, is the filter control parameter;

[0034] The derivative operator is used to calculate the horizontal and vertical changes of the smoothed image to obtain the change amplitude. and direction of change :

[0035]

[0036]

[0037]

[0038]

[0039] The change amplitude and direction of change As the eigenvalue element in the image feature set K.

[0040] According to a specific implementation of the embodiment of the present disclosure, the performance evaluation of the loading environment of the full-screen carousel is performed to obtain a loading performance vector M=[PLT, TTFB, LCP, RI], including:

[0041] By loading the standard test data in the loading environment of the full-screen carousel, the loading performance vector M=[PLT,TTFB,LCP,RI] is obtained.

[0042]

[0043] is the DNS resolution time of the loading environment, It is the TCP connection establishment time of the loading environment. is the SSL handshake time, is the server response time for loading the environment, is the download time of the standard test data, is the page rendering time of the standard test data;

[0044]

[0045] Indicates the processing time of the loading environment for standard test data;

[0046]

[0047] represents the image processing time in the standard test data, represents the video processing time in the standard test data, represents the audio processing time in the standard test data;

[0048]

[0049] Among them, V(t) is the completion ratio of the visible area of ​​the page at time t, and T is the time required for the page to fully load the standard test data.

[0050] According to a specific implementation of the embodiment of the present disclosure, based on the loading performance vector M and the image feature set K, each image in the carousel image set P is optimized and calculated to obtain an optimization parameter set Y={Y1, Y2, ...Yn}, including:

[0051] Using a machine learning method to establish an optimization model, the input of the optimization model is M and K, and the output is the optimization parameter Y;

[0052] For each image Pi in the carousel image set P, a set of specific optimization parameters Yi is calculated through the optimization model, and the optimization parameters include: image size adjustment ratio, image format selection, and image compression ratio;

[0053] Combine the optimization parameters Yi to obtain the optimization parameter set Y={Y1,Y2,…Yn}.

[0054] According to a specific implementation of an embodiment of the present disclosure, based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf={Pf1, Pf2, ...Pfq} and a second carousel image set Ps={Ps1, Ps2, ...Psk}, including:

[0055] According to the indicators in the optimization parameter set Y, a weighted score is calculated for each image Pi in the carousel image set P;

[0056] The q images with the highest scores are selected to form the first carousel image set Pf={Pf1, Pf2, …Pfq}, and the remaining images form the second carousel image set Ps={Ps1, Ps2, …Psk}.

[0057] According to a specific implementation of the embodiment of the present disclosure, in the HTML of the page where the full-screen carousel image is located, the class name Lm and the data attribute Dpr are added to the images in the first carousel image set Pf, and the class name Lm, the data attribute Dpr and the URL of the image in the first carousel image set are combined to construct a ternary loading data set Syj={Lm, Dpr, URL}, including:

[0058] For each image label belonging to the set Pf In , these images are labeled by adding the class name Lm;

[0059] Add a custom data attribute Dpr to the image of the Pf collection to store specific instructions or priority information;

[0060] Make sure the src attribute of each image in the Pf collection correctly points to an optimized or temporary loading placeholder URL, and use the src attribute to store the URL of the original high-quality image so that it can be used instead when the image actually needs to be loaded.

[0061] According to a specific implementation of the embodiment of the present disclosure, the method further includes:

[0062] Use CSS3 media queries to adjust image size, layout, and style according to different screen sizes to adapt to different devices;

[0063] Use feature detection to determine what features a browser supports and provide fallback mechanisms for unsupported features to fill in the gaps in functionality for older browsers.

[0064] Use HTML5 touch event listeners to respond to user swipes and touches. Add swipe detection logic to ensure that the interactive experience of the carousel on mobile devices is as smooth as on desktop devices.

[0065] Use the ARIA standard to provide text alternatives using HTML tags and attributes, allowing screen readers to interpret and manipulate the slideshow content.

[0066] According to a specific implementation of the embodiment of the present disclosure, the method further includes:

[0067] Pre-render dynamic content into static HTML content so that search engine crawlers can crawl and index the static HTML content;

[0068] Aim for animations by using CSS3 hardware-accelerated transitions or animations, and avoid using JavaScript to perform animations.

[0069] A full-screen carousel image control device based on jQuery, comprising:

[0070] An acquisition module acquires n images that need to be displayed in full-screen carousel to form a carousel image set P={P1, P2, ..., Pn}, and performs feature extraction on each image in the carousel image set P to obtain an image feature set K={K1, K2, ..., Kn};

[0071] The evaluation module performs a performance evaluation on the loading environment of the full-screen carousel image and obtains a loading performance vector M=[PLT, TTFB, LCP, RI], where PLT represents the page loading time of the page where the full-screen carousel image is located, TTFB represents the first content rendering time of the page where the full-screen carousel image is located, LCP represents the maximum content drawing time of the page where the full-screen carousel image is located, and RI represents the response index of the page where the full-screen carousel image is located;

[0072] The optimization module performs optimization calculation on each image in the carousel image set P based on the loading performance vector M and the image feature set K to obtain an optimization parameter set Y={Y1, Y2, ...Yn}, where Yi represents the optimization parameter for the i-th image in the carousel image set P. Based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf={Pf1, Pf2, ...Pfq} and a second carousel image set Ps={Ps1, Ps2, ...Psk}, where the sum of q and k is equal to n;

[0073] Adding module, in the HTML of the page where the full-screen slideshow is located, adding class name Lm and data attribute Dpr for the images in the first slideshow image set Pf, and constructing a ternary loading data set Syj={Lm, Dpr, URL} with the class name Lm, the data attribute Dpr and the URL of the image in the first slideshow image set, wherein the ternary loading data set Syj is used to load the images in the first slideshow image set Pf on the page where the full-screen slideshow is located;

[0074] The loading module sets a loading instance for the second carousel image set in the jQuery statement of the page where the full-screen carousel image is located. The loading instance includes a callback function and a configuration object. The callback function starts when the ternary loading data set is called. A loading threshold is set inside the configuration object. When the image loading ratio in the first carousel image set exceeds the loading threshold, the configuration object uses the image processing function G contained inside to perform image optimization processing on the images in the second carousel image set Ps according to the optimization parameter set Y to form a second carousel optimized image set Psh. The second carousel optimized image set Psh is loaded on the page where the full-screen carousel image is located after the first carousel image set Pf is loaded.

[0075] In a second aspect, an embodiment of the present invention provides a jQuery-based full-screen carousel image control device, comprising:

[0076] The collection module collects text data from n online information platforms in real time within a preset time period to form a heterogeneous data set D = {D1, D2, …, Dn};

[0077] A transformation module, which performs denoising, language detection, standardization, part-of-speech tagging and named entity recognition operations on the heterogeneous data set D={D1, D2, ..., Dn}, and transforms the heterogeneous data set D={D1, D2, ..., Dn} into a standard data set B={B1, B2, ..., Bn};

[0078] An extraction module performs feature extraction on the standard data set B={B1, B2, …, Bn} to obtain an information feature vector K=[E, S, I, R], where E represents the sentiment intensity of the standard data set, S represents the subject sensitivity of the standard data set, I represents the influence of the publisher of the standard data set, and R represents the information dissemination range of the standard data set;

[0079] The execution module performs numerical calculation on the information feature vector K based on a predefined evaluation function G to obtain the information evaluation value Zp=G(B,K) of the standard data set B, so as to determine whether it is necessary to issue an information warning for the text data collected in real time by the n online information platforms based on the information evaluation value Zp.

[0080] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0081] at least one processor; and,

[0082] a memory communicatively connected to the at least one processor; wherein,

[0083] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the jQuery-based full-screen carousel control method in any of the aforementioned first aspects or any of the implementations of the first aspect.

[0084] In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the jQuery-based full-screen carousel control method in the aforementioned first aspect or any implementation of the first aspect.

[0085] In the fifth aspect, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the jQuery-based full-screen carousel control method in the aforementioned first aspect or any implementation of the first aspect.

[0086] The jQuery-based full-screen carousel control scheme in the embodiment of the present invention includes: obtaining n images that need to be full-screen carousel to form a carousel image set P={P1, P2, ..., Pn}, performing feature extraction on each image in the carousel image set P to obtain an image feature set K={K1, K2, ..., Kn}; performing performance evaluation on the loading environment of the full-screen carousel to obtain a loading performance vector M=[PLT, TTFB,LCP,RI], PLT represents the page loading time of the page where the full-screen carousel image is located, TTFB represents the first content rendering time of the page where the full-screen carousel image is located, LCP represents the maximum content drawing time of the page where the full-screen carousel image is located, and RI represents the response index of the page where the full-screen carousel image is located; based on the loading performance vector M and the image feature set K, each image in the carousel image set P is optimized and calculated to obtain an optimization parameter set Y={Y1,Y2,…Yn}, Yi represents the optimization parameter for the i-th image in the carousel image set P, based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf={Pf1,Pf2,…Pfq} and a second carousel image set Ps={Ps1,Ps2,…Psk}, and the sum of q and k is equal to n; in the HTML of the page where the full-screen carousel image is located, the class name Lm and the data attribute Dpr are added to the images in the first carousel image set Pf, and the class name L m, data attribute Dpr and the URL of the image in the first carousel image set, construct a ternary loading data set Syj={Lm,Dpr,URL}, the ternary loading data set Syj is used to load the images in the first carousel image set Pf on the page where the full-screen carousel image is located; in the jQuery statement of the page where the full-screen carousel image is located, set a loading instance for the second carousel image set, the loading instance includes a callback function and a configuration object, the callback function starts to start when the ternary loading data set is called, and a loading threshold is set inside the configuration object. When the image loading ratio in the first carousel image set exceeds the loading threshold, the configuration object uses the image processing function G contained inside to optimize the images in the second carousel image set Ps according to the optimization parameter set Y to form a second carousel optimized image set Psh. The second carousel optimized image set Psh is loaded on the page where the full-screen carousel image is located after the first carousel image set Pf is loaded. The present invention solves the technical defects of traditional jQuery full-screen carousel images in terms of performance, responsive design, browser compatibility, touch event support, accessibility, SEO impact, code maintenance and animation effects, and improves the loading performance and user experience of the jQuery full-screen carousel images. BRIEF DESCRIPTION OF THE DRAWINGS

[0087] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0088] Figure 1 A schematic diagram of a flow chart of a full-screen carousel control method based on jQuery provided in an embodiment of the present invention;

[0089] Figure 2 A schematic diagram of another method for controlling a full-screen slideshow based on jQuery provided in an embodiment of the present invention;

[0090] Figure 3 A schematic diagram of the structure of a full-screen carousel control device based on jQuery provided in an embodiment of the present invention;

[0091] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0092] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0093] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0094] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0095] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0096] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.

[0097] The disclosed embodiment provides a jQuery-based full-screen carousel control method. The jQuery-based full-screen carousel control method provided in this embodiment can be executed by a computing device, which can be implemented as software, or as a combination of software and hardware, and the computing device can be integrated in a server, terminal device, etc.

[0098] See also Figure 1 and Figure 2 The embodiment of the present disclosure provides a full-screen carousel image control method based on jQuery, including:

[0099] S101, obtaining n images that need to be displayed in full-screen carousel to form a carousel image set P={P1, P2, ..., Pn}, performing feature extraction on each image in the carousel image set P to obtain an image feature set K={K1, K2, ..., Kn}.

[0100] Specifically, a filter can be used to smooth the image:

[0101]

[0102] in, is the original image, is the Gaussian kernel function, represents the convolution operation, is the filter control parameter;

[0103] The derivative operator is used to calculate the horizontal and vertical changes of the smoothed image to obtain the change amplitude. and direction of change :

[0104]

[0105]

[0106]

[0107]

[0108] The change amplitude and direction of change As the eigenvalue elements in the image feature set K, the image feature set K={K1, K2,…, Kn} is obtained.

[0109] S102, performing a performance evaluation on the loading environment of the full-screen carousel to obtain a loading performance vector M=[PLT, TTFB, LCP, RI], where PLT represents the page loading time of the page where the full-screen carousel is located, TTFB represents the first content rendering time of the page where the full-screen carousel is located, LCP represents the maximum content drawing time of the page where the full-screen carousel is located, and RI represents the response index of the page where the full-screen carousel is located.

[0110] By loading the standard test data in the loading environment of the full-screen carousel, the loading performance vector M=[PLT,TTFB,LCP,RI] is obtained. Specifically:

[0111]

[0112] is the DNS resolution time of the loading environment, It is the TCP connection establishment time of the loading environment. is the SSL handshake time, is the server response time for loading the environment, is the download time of the standard test data, is the page rendering time of the standard test data;

[0113]

[0114] Indicates the processing time of the loading environment for standard test data;

[0115]

[0116] represents the image processing time in the standard test data, represents the video processing time in the standard test data, represents the audio processing time in the standard test data;

[0117]

[0118] Among them, V(t) is the completion ratio of the visible area of ​​the page at time t, and T is the time required for the page to fully load the standard test data.

[0119] S103, based on the loading performance vector M and the image feature set K, optimize and calculate each image in the carousel image set P to obtain an optimization parameter set Y={Y1,Y2,…Yn}, Yi represents the optimization parameters for the i-th image in the carousel image set P, and based on the optimization parameter set Y, divide the images in the carousel image set P into a first carousel image set Pf={Pf1,Pf2,…Pfq} and a second carousel image set Ps={Ps1,Ps2,…Psk}, and the sum of q and k is equal to n.

[0120] Based on the optimization parameter set Y, a strategy can be designed to divide the carousel image set P and create two subsets: the first carousel image set Pf = {Pf1, Pf2, ... Pfq} and the second carousel image set Ps = {Ps1, Ps2, ... Psk}, Pf is used for fast loading, and Ps is used for standard loading. The goal of the division is to ensure that the images in Pf can be loaded quickly to provide an instant user experience, while the images in Ps display higher quality or larger size content without seriously slowing down the overall performance of the page. The following are the specific steps:

[0121] Based on the metrics in the optimization parameter Y, such as compression level, resizing ratio, etc., each image is given a comprehensive score that reflects its expected loading speed. For example, highly compressed and size-optimized images have high scores and are suitable for fast loading. Based on the relative importance of the content of the carousel in conveying information or attracting users, key information or guiding images may be assigned to Pf first.

[0122] For each image Pi, a weighted score Si = w1Yi1 + w2Yi2 + ... + wnYin is calculated, where Yij is the jth optimization parameter of the i-th image, and wij is the corresponding weight, reflecting the contribution of the parameter to the loading speed.

[0123] The q images with the highest scores are selected. These images are optimized to ensure fast loading and are suitable for initial page rendering or the first display of user interaction to form the first carousel image set Pf. The remaining images form the Ps set, which may retain higher quality or size but have a slower loading speed and can be arranged to be displayed after the user has had some interaction or the page has been partially loaded.

[0124] During implementation, JavaScript or front-end frameworks can be used to implement a dynamic loading mechanism, that is, images in Pf are loaded and displayed first, and images in Ps are loaded lazily or when scrolling to the visible area. According to the performance of the user's device and network conditions, the specific content or loading strategy of Pf and Ps can be dynamically adjusted to maximize the user experience.

[0125] S104, in the HTML of the page where the full-screen carousel image is located, add the class name Lm and the data attribute Dpr for the images in the first carousel image set Pf, and construct a ternary loading data set Syj={Lm,Dpr,URL} together with the class name Lm, the data attribute Dpr and the URL of the image in the first carousel image set. The ternary loading data set Syj is used to load the images in the first carousel image set Pf on the page where the full-screen carousel image is located.

[0126] In the HTML structure of the full-screen slideshow page, in order to implement special processing for the images in the first slideshow image set Pf, the following operations can be performed to construct the ternary loading dataset Syj:

[0127] For each image label belonging to the set Pf` `, mark these images by adding the class name `Lm`. This class name will serve as an indication to inform CSS or JavaScript that these images need special treatment, such as loading them first or applying specific styles.

[0128] In addition to the class name, a custom data attribute `data-dpr` (or simply `data-pr`, depending on your preference) is added to these images to store specific instructions or priority information. For example, `data-dpr="high"` can be used to indicate that an image has high priority or specific rendering requirements.

[0129] Make sure each image's src attribute correctly points to an optimized or temporary loading placeholder URL, and use the data-src attribute to store the URL of the original high-quality image so that it can be used instead when the image actually needs to be loaded.

[0130] The processing information of each image can be organized into a set Syj in the form of triples. Each triple contains:

[0131] Class name Lm: Indicates that the image belongs to a category that is prioritized for loading or special processing.

[0132] The value of the data attribute Dpr: conveys the priority or other specific instructions of the image.

[0133] Image URL: The image address used when actually loading, which may be one of `src` or `data-src`.

[0134] S105, in the jQuery statement of the page where the full-screen carousel image is located, set a loading instance for the second carousel image set, the loading instance includes a callback function and a configuration object, the callback function starts to start when the ternary loading data set is called, and a loading threshold is set inside the configuration object. When the image loading ratio in the first carousel image set exceeds the loading threshold, the configuration object uses the image processing function G contained inside to perform image optimization processing on the images in the second carousel image set Ps according to the optimization parameter set Y to form a second carousel optimized image set Psh. The second carousel optimized image set Psh is loaded on the page where the full-screen carousel image is located after the first carousel image set Pf is loaded.

[0135] You can use jQuery to monitor the loading completion of images in Pf and accumulate the number of images that have been loaded. By setting a loading threshold in the configuration object, when the loading ratio of Pf images exceeds this threshold, the callback function is triggered.

[0136] When the callback function starts, the image processing function G is applied to each image in the second carousel image set (Ps), and the image is optimized according to the optimization parameter set Y (such as compression rate, size adjustment, etc.). After the processing is completed, an optimized image set Psh is generated, which contains the processed image data or URL. After all Pfs are loaded, the images in Psh are loaded to achieve a smooth user experience and resource management.

[0137] Specifically, you can use the jQuery selector to select all images in Pf and bind a loading completion event listener to them.

[0138] A counter is maintained inside the listening function of the event listener. Every time an image is loaded, the value of the counter is increased and checked whether the preset loading threshold is reached.

[0139] Define a configuration object, including the loading threshold and callback function. The callback function executes the image processing logic inside and processes the images in Ps according to the optimization parameter Y. In the callback function, traverse the images in Ps, use the G function (including the custom image processing logic) to apply the optimization parameter Y to each image, generate the optimized image data or URL, and build the Psh collection.

[0140] When all Pf images are loaded and Psh is ready, start loading images in Psh. You can use jQuery's `.attr()` method to update the `src` attribute, or dynamically insert new ` `Tag.

[0141] Through the above method, the loading process of the full-screen carousel can be effectively managed and optimized to improve the user experience.

[0142] According to a specific implementation of the embodiment of the present disclosure, the step of acquiring n images that need to be displayed in full-screen carousel to form a carousel image set P={P1, P2, ..., Pn}, and performing feature extraction on each image in the carousel image set P to obtain an image feature set K={K1, K2, ..., Kn} includes:

[0143] Use a filter to smooth an image:

[0144]

[0145] in, is the original image, is the Gaussian kernel function, represents the convolution operation, is the filter control parameter;

[0146] The derivative operator is used to calculate the horizontal and vertical changes of the smoothed image to obtain the change amplitude. and direction of change :

[0147]

[0148]

[0149]

[0150]

[0151] The change amplitude and direction of change As the eigenvalue element in the image feature set K.

[0152] According to a specific implementation of the embodiment of the present disclosure, the performance evaluation of the loading environment of the full-screen carousel is performed to obtain a loading performance vector M=[PLT, TTFB, LCP, RI], including:

[0153] By loading the standard test data in the loading environment of the full-screen carousel, the loading performance vector M=[PLT,TTFB,LCP,RI] is obtained.

[0154]

[0155] is the DNS resolution time of the loading environment, It is the TCP connection establishment time of the loading environment. is the SSL handshake time, is the server response time for loading the environment, is the download time of the standard test data, is the page rendering time of the standard test data;

[0156]

[0157] Indicates the processing time of the loading environment for standard test data;

[0158]

[0159] represents the image processing time in the standard test data, represents the video processing time in the standard test data, represents the audio processing time in the standard test data;

[0160]

[0161] Among them, V(t) is the completion ratio of the visible area of ​​the page at time t, and T is the time required for the page to fully load the standard test data.

[0162] According to a specific implementation of the embodiment of the present disclosure, based on the loading performance vector M and the image feature set K, each image in the carousel image set P is optimized and calculated to obtain an optimization parameter set Y={Y1, Y2, ...Yn}, including:

[0163] Using a machine learning method to establish an optimization model, the input of the optimization model is M and K, and the output is the optimization parameter Y;

[0164] For each image Pi in the carousel image set P, a set of specific optimization parameters Yi is calculated through the optimization model, and the optimization parameters include: image size adjustment ratio, image format selection, and image compression ratio;

[0165] Combine the optimization parameters Yi to obtain the optimization parameter set Y={Y1,Y2,…Yn}.

[0166] According to a specific implementation of an embodiment of the present disclosure, based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf={Pf1, Pf2, ...Pfq} and a second carousel image set Ps={Ps1, Ps2, ...Psk}, including:

[0167] According to the indicators in the optimization parameter set Y, a weighted score is calculated for each image Pi in the carousel image set P;

[0168] The q images with the highest scores are selected to form the first carousel image set Pf={Pf1, Pf2, …Pfq}, and the remaining images form the second carousel image set Ps={Ps1, Ps2, …Psk}.

[0169] According to a specific implementation of the embodiment of the present disclosure, in the HTML of the page where the full-screen carousel image is located, the class name Lm and the data attribute Dpr are added to the images in the first carousel image set Pf, and the class name Lm, the data attribute Dpr and the URL of the image in the first carousel image set are combined to construct a ternary loading data set Syj={Lm, Dpr, URL}, including:

[0170] For each image label belonging to the set Pf In , these images are labeled by adding the class name Lm;

[0171] Add a custom data attribute Dpr to the image of the Pf collection to store specific instructions or priority information;

[0172] Make sure the src attribute of each image in the Pf collection correctly points to an optimized or temporary loading placeholder URL, and use the src attribute to store the URL of the original high-quality image so that it can be used instead when the image actually needs to be loaded.

[0173] According to a specific implementation of the embodiment of the present disclosure, the method further includes:

[0174] Use CSS3 media queries to adjust image size, layout, and style according to different screen sizes to adapt to different devices;

[0175] Use feature detection to determine what features a browser supports and provide fallback mechanisms for unsupported features to fill in the gaps in functionality for older browsers.

[0176] Use HTML5 touch event listeners to respond to user swipes and touches. Add swipe detection logic to ensure that the interactive experience of the carousel on mobile devices is as smooth as on desktop devices.

[0177] Use the ARIA standard to provide text alternatives using HTML tags and attributes, allowing screen readers to interpret and manipulate the slideshow content.

[0178] According to a specific implementation of the embodiment of the present disclosure, the method further includes:

[0179] Pre-render dynamic content into static HTML content so that search engine crawlers can crawl and index the static HTML content;

[0180] Aim for animations by using CSS3 hardware-accelerated transitions or animations, and avoid using JavaScript to perform animations.

[0181] Corresponding to the above method embodiment, see Figure 3 The embodiment of the present invention further discloses a jQuery-based full-screen carousel image control device 30, comprising:

[0182] The acquisition module 301 acquires n images that need to be displayed in full-screen carousel to form a carousel image set P={P1, P2, ..., Pn}, and performs feature extraction on each image in the carousel image set P to obtain an image feature set K={K1, K2, ..., Kn};

[0183] Evaluation module 302 performs performance evaluation on the loading environment of the full-screen carousel to obtain a loading performance vector M=[PLT, TTFB, LCP, RI], where PLT represents the page loading time of the page where the full-screen carousel is located, TTFB represents the first content rendering time of the page where the full-screen carousel is located, LCP represents the maximum content drawing time of the page where the full-screen carousel is located, and RI represents the response index of the page where the full-screen carousel is located;

[0184] The optimization module 303 performs optimization calculation on each image in the carousel image set P based on the loading performance vector M and the image feature set K to obtain an optimization parameter set Y={Y1, Y2, ...Yn}, where Yi represents the optimization parameter for the i-th image in the carousel image set P. Based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf={Pf1, Pf2, ...Pfq} and a second carousel image set Ps={Ps1, Ps2, ...Psk}, where the sum of q and k is equal to n;

[0185] Adding module 304, in the HTML of the page where the full-screen slideshow image is located, adds a class name Lm and a data attribute Dpr to the images in the first slideshow image set Pf, and constructs a ternary loading data set Syj={Lm, Dpr, URL} with the class name Lm, the data attribute Dpr, and the URL of the image in the first slideshow image set, wherein the ternary loading data set Syj is used to load the images in the first slideshow image set Pf on the page where the full-screen slideshow image is located;

[0186] The loading module 305 sets a loading instance for the second carousel image set in the jQuery statement of the page where the full-screen carousel image is located. The loading instance includes a callback function and a configuration object. The callback function starts when the ternary loading data set is called. A loading threshold is set inside the configuration object. When the image loading ratio in the first carousel image set exceeds the loading threshold, the configuration object uses the image processing function G contained inside to perform image optimization processing on the images in the second carousel image set Ps according to the optimization parameter set Y to form a second carousel optimized image set Psh. The second carousel optimized image set Psh is loaded on the page where the full-screen carousel image is located after the first carousel image set Pf is loaded.

[0187] See also Figure 4 The embodiment of the present invention further provides an electronic device 60, the electronic device comprising:

[0188] at least one processor; and,

[0189] a memory communicatively connected to the at least one processor; wherein,

[0190] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the jQuery-based full-screen carousel control method in the aforementioned method embodiment.

[0191] An embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the aforementioned method embodiment.

[0192] An embodiment of the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the jQuery-based full-screen carousel control method in the aforementioned method embodiment.

[0193] Reference below Figure 4 , which shows a schematic diagram of the structure of an electronic device 60 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic 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 disclosure.

[0194] like Figure 4 As shown, the electronic device 60 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 60 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0195] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, a gage, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 60 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 60 is shown with various devices, but it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have instead.

[0196] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0197] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A full-screen carousel control method based on jQuery, characterized in that: include: Obtain n images that need to be displayed in full-screen carousel to form a carousel image set P = {P1, P2, ..., Pn}, perform feature extraction on each image in the carousel image set P to obtain an image feature set K = {K1, K2, ..., Kn}; The loading environment of the full-screen carousel is evaluated for performance, and a loading performance vector M = [PLT, TTFB, LCP, RI] is obtained, where PLT represents the page loading time of the page where the full-screen carousel is located, TTFB represents the first content rendering time of the page where the full-screen carousel is located, LCP represents the maximum content drawing time of the page where the full-screen carousel is located, and RI represents the response index of the page where the full-screen carousel is located; Based on the loading performance vector M and the image feature set K, each image in the carousel image set P is optimized and calculated to obtain an optimization parameter set Y = {Y1, Y2, ...Yn}, Yi represents the optimization parameter for the i-th image in the carousel image set P, and based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf = {Pf1, Pf2, ...Pfq} and a second carousel image set Ps = {Ps1, Ps2, ...Psk}, and the sum of q and k is equal to n; In the HTML of the page where the full-screen slideshow image is located, add the class name Lm and the data attribute Dpr to the images in the first slideshow image set Pf, and construct a ternary loading data set Syj={Lm, Dpr, URL} by combining the class name Lm, the data attribute Dpr, and the URL of the image in the first slideshow image set. The ternary loading data set Syj is used to load the images in the first slideshow image set Pf on the page where the full-screen slideshow image is located. In the jQuery statement of the page where the full-screen carousel image is located, a loading instance is set for the second carousel image set, the loading instance includes a callback function and a configuration object, the callback function starts to start when the ternary loading data set is called, and a loading threshold is set inside the configuration object. When the image loading ratio in the first carousel image set exceeds the loading threshold, the configuration object uses the image processing function G contained inside to perform image optimization processing on the images in the second carousel image set Ps according to the optimization parameter set Y to form a second carousel optimized image set Psh. The second carousel optimized image set Psh is loaded on the page where the full-screen carousel image is located after the first carousel image set Pf is loaded; The method of dividing the images in the carousel image set P into a first carousel image set Pf={Pf1, Pf2, ...Pfq} and a second carousel image set Ps={Ps1, Ps2, ...Psk} based on the optimization parameter set Y includes: According to the indicators in the optimization parameter set Y, a weighted score is calculated for each image Pi in the carousel image set P; The q images with the highest scores are selected to form a first carousel image set Pf = {Pf1, Pf2, ... Pfq}, and the remaining images form a second carousel image set Ps = {Ps1, Ps2, ... Psk}.

2. The method according to claim 1, characterized in that The method of acquiring n images that need to be displayed in full-screen carousel to form a carousel image set P = {P1, P2, ..., Pn}, and extracting features from each image in the carousel image set P to obtain an image feature set K = {K1, K2, ..., Kn} includes: Use a filter to smooth an image: I smooth (x,y)=G σ *I(x,y) Among them, I(x,y) is the original image, G σ is the Gaussian kernel function, * represents the convolution operation, and σ is the filtering control parameter; The derivative operator is used to calculate the horizontal and vertical changes of the smoothed image to obtain the change amplitude G(x,y) and change direction θ(x,y): G x (x,y)=(I smooth (x+1,y)-I smooth (x-1,y)) G y (x,y)=(I smooth (x,y+1)-I smooth (x,y-1)) The change amplitude G(x, y) and the change direction θ(x, y) are taken as the feature value elements in the image feature set K.

3. The method according to claim 2, characterized in that The performance evaluation of the loading environment of the full-screen carousel is performed to obtain a loading performance vector M=[PLT, TTFB, LCP, RI], including: By loading the standard test data in the loading environment of the full-screen carousel, the loading performance vector M = [PLT, TTFB, LCP, RI] is obtained. PLT=T DNS +T TCP +T SSL +T ServerResponse +T ContentDownload +T Render T DNS is the DNS resolution time of the loading environment, T TCP is the TCP connection establishment time of the loading environment, T SSL is the SSL handshake time, T ServerResponse is the server response time of the loading environment, T ContentDownload is the download time of the standard test data, T Render is the page rendering time of the standard test data; TTFB=T DNS +T TCP +T SSL +T ServerProcessing T ServerProcessing Indicates the processing time of the loading environment for standard test data; LCP=T IG +T VD +T SD T IG represents the image processing time in the standard test data, T VD represents the video processing time in the standard test data, T SD represents the audio processing time in the standard test data; Among them, V(t) is the completion ratio of the visible area of ​​the page at time t, and T is the time required for the page to fully load the standard test data.

4. The method according to claim 3, characterized in that The optimization calculation is performed on each image in the carousel image set P based on the loading performance vector M and the image feature set K to obtain an optimization parameter set Y={Y1, Y2, ...Yn}, including: Using a machine learning method to establish an optimization model, the input of the optimization model is M and K, and the output is the optimization parameter Y; For each image Pi in the carousel image set P, a set of specific optimization parameters Yi is calculated through the optimization model, and the optimization parameters include: image size adjustment ratio, image format selection, and image compression ratio; The optimization parameters Yi are combined to obtain an optimization parameter set Y = {Y1, Y2, ...Yn}.

5. The method according to claim 1, characterized in that In the HTML of the page where the full-screen slideshow image is located, the class name Lm and the data attribute Dpr are added to the images in the first slideshow image set Pf, and the class name Lm, the data attribute Dpr and the URL of the image in the first slideshow image set are combined to construct a ternary loading data set Syj={Lm, Dpr, URL}, including: For each image label belonging to the set Pf In , these images are labeled by adding the class name Lm; Add a custom data attribute Dpr to the image of the Pf collection to store specific instructions or priority information; Make sure the src attribute of each image in the Pf collection correctly points to an optimized or temporary loading placeholder URL, and use the src attribute to store the URL of the original high-quality image so that it can be used instead when the image actually needs to be loaded.

6. The method according to claim 5, characterized in that The method further comprises: Use CSS3 media queries to adjust image size, layout, and style according to different screen sizes to adapt to different devices; Use feature detection to determine what features a browser supports and provide fallback mechanisms for unsupported features to fill in the gaps in functionality for older browsers. Use HTML5 touch event listeners to respond to user swipes and touches. Add swipe detection logic to ensure that the interactive experience of the carousel on mobile devices is as smooth as on desktop devices. Use the ARIA standard to provide text alternatives using HTML tags and attributes, allowing screen readers to interpret and manipulate the slideshow content.

7. The method according to claim 6, characterized in that The method further comprises: Pre-render dynamic content into static HTML content so that search engine crawlers can crawl and index the static HTML content; Aim for animations by using CSS3 hardware-accelerated transitions or animations, and avoid using JavaScript to perform animations.

8. A full-screen carousel control device based on jQuery, characterized in that: include: An acquisition module acquires n images that need to be displayed in full-screen carousel to form a carousel image set P = {P1, P2, ..., Pn}, and performs feature extraction on each image in the carousel image set P to obtain an image feature set K = {K1, K2, ..., Kn}; The evaluation module performs a performance evaluation on the loading environment of the full-screen carousel image, and obtains a loading performance vector M = [PLT, TTFB, LCP, RI], where PLT represents the page loading time of the page where the full-screen carousel image is located, TTFB represents the first content rendering time of the page where the full-screen carousel image is located, LCP represents the maximum content drawing time of the page where the full-screen carousel image is located, and RI represents the response index of the page where the full-screen carousel image is located; The optimization module performs optimization calculation on each image in the carousel image set P based on the loading performance vector M and the image feature set K to obtain an optimization parameter set Y = {Y1, Y2, ...Yn}, where Yi represents the optimization parameter for the i-th image in the carousel image set P. Based on the optimization parameter set Y, the images in the carousel image set P are divided into a first carousel image set Pf = {Pf1, Pf2, ...Pfq} and a second carousel image set Ps = {Ps1, Ps2, ...Psk}, where the sum of q and k is equal to n; Adding module, in the HTML of the page where the full-screen slideshow is located, adding class name Lm and data attribute Dpr to the images in the first slideshow image set Pf, and constructing a ternary loading data set Syj = {Lm, Dpr, URL} together with the class name Lm, the data attribute Dpr and the URL of the image in the first slideshow image set, wherein the ternary loading data set Syj is used to load the images in the first slideshow image set Pf on the page where the full-screen slideshow is located; The loading module sets a loading instance for the second carousel image set in the jQuery statement of the page where the full-screen carousel image is located. The loading instance includes a callback function and a configuration object. The callback function starts to start when the ternary loading data set is called. The configuration object is internally provided with a loading threshold. When the image loading ratio in the first carousel image set exceeds the loading threshold, the configuration object uses the image processing function G contained therein to perform image optimization processing on the images in the second carousel image set Ps according to the optimization parameter set Y to form a second carousel optimized image set Psh. The second carousel optimized image set Psh is loaded on the page where the full-screen carousel image is located after the first carousel image set Pf is loaded. The method of dividing the images in the carousel image set P into a first carousel image set Pf={Pf1, Pf2, ...Pfq} and a second carousel image set Ps={Ps1, Ps2, ...Psk} based on the optimization parameter set Y includes: According to the indicators in the optimization parameter set Y, a weighted score is calculated for each image Pi in the carousel image set P; The q images with the highest scores are selected to form a first carousel image set Pf = {Pf1, Pf2, ... Pfq}, and the remaining images form a second carousel image set Ps = {Ps1, Ps2, ... Psk}.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the jQuery-based full-screen carousel control method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Picture loading method, terminal equipment and medium

    CN108595698A

  • Carousel graph display method and device, electronic equipment and computer readable medium

    CN110764921A

  • Page carousel method and device, computer equipment and readable storage medium

    CN111563213A

  • Carousel picture display method and device, computer equipment and storage medium

    CN114371902A

  • Image special effect processing method and apparatus, and electronic device and computer readable storage medium

    US20240163392A1