The effect of zooming in on a Taobao store is similar to the principle of using a slideshow.

The effect of zooming in on a Taobao store is similar to the principle of using a slideshow.
Today I got familiar with the mouse zooming effect on the front end of Taobao, which is similar to the principle of using slides. I will analyze this code here.

Copy code
The code is as follows:

<div class="sub all_t1"
style="width:160px;height:107px;background:url(upload/2022/web/T2khnoXihaXXXXXXXX_!!845309971.png_160x160.jpg) no-repeat;">
<div data-widget-config="{'trigger':'.all_t1','align':{'node':'.all_t1','offset':[0,-160],'points':['bc','tc']}}" data-widget-type="Popup" class="J_TWidget hidden">
<div style="width:310px;height:207px;background:url(upload/2022/web/T2khnoXihaXXXXXXXX_!!845309971.png_310x310.jpg) no-repeat"></div>
</div>
</div>

class="J_TWidget hidden" is the key to Taobao's built-in js code to control image attributes. It is used to obtain the node of the div and control the node. As for style, it is the definition of the style, including length, width, background image

<div data-widget-config="{'trigger':'.all_t1','align':{'node':'.all_t1','offset':[0,-160],'points':['bc','tc']}}" data-widget-type="Popup" class="J_TWidget hidden"> This is undoubtedly the definition of the properties of the special effects.

node: 'custom', // reference element. The popup is positioned relative to the reference element. Just like writing contacts,

Supports writing of class and id selectors

points: [tr,tl], // ['tl', 'tr'] means that the popup's tl is aligned with the reference node's tr.

For the specific meaning and value of tl and tr, please see the screenshot below.

t(top),c(center),b(bottom),l(left),r(right)

offset: [0,0] // Valid value is [n, m], after points are aligned, offset value,

Generally, it can be used for fine-tuning. n and m represent the alignment of two points.

The offset between the x and y coordinates

<<:  Example of using negative margin to achieve average layout in CSS

>>:  vsftpd virtual user based on MySql authentication

Recommend

How to use Portainer to build a visual interface for Docker

Portainer Introduction Portainer is a graphical m...

How to deploy hbase using docker

Standalone hbase, let’s talk about it first. Inst...

Example code of how CSS matches multiple classes

CSS matches multiple classes The following HTML t...

Pure HTML+CSS to achieve typing effect

This article mainly introduces the typing effect ...

JavaScript super detailed implementation of web page carousel

Table of contents Creating HTML Pages Implement t...

Solution to the horizontal scroll bar in iframe under IE6

The situation is as follows: (PS: The red box repr...

Example code for implementing verification code login in SMS API in Node

1. Node server setup + database connection The op...

MySQL permissions and database design case study

Permissions and database design User Management U...

15 Vim quick reference tables to help you increase your efficiency by N times

I started using Linux for development and enterta...

Configure VIM as a C++ development editor in Ubuntu

1. Copy the configuration file to the user enviro...

Good website copywriting and good user experience

Looking at a website is actually like evaluating a...

Example code for achieving hollowing effect with pure CSS

I have recently studied the hollowing effect. bac...

About dynamically adding routes based on user permissions in Vue

Display different menu pages according to the use...