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

VUE+Canvas implements the game of God of Wealth receiving ingots

Welcome to the previous canvas game series: 《VUE ...

Summary of five commands to check swap space in Linux

Preface Two types of swap space can be created un...

Vue implements top left and right sliding navigation

Navigation and other things are often used in dai...

Solution to MySQL service 1067 error: modify the mysql executable file path

Today I encountered the MySQL service 1067 error ...

Detailed explanation of three solutions to the website footer sinking effect

Background Many website designs generally consist...

Steps to run ASP.NET Core in Docker container

There are too much knowledge to learn recently, a...

Detailed explanation of Docker Swarm service orchestration commands

1. Introduction Docker has an orchestration tool ...

Implementing long shadow of text in less in CSS3

This article mainly introduces how to implement l...

In-depth understanding of javascript prototype and prototype chain

Table of contents 1. What is a prototype? 2. Prot...

How to quickly build ELK based on Docker

[Abstract] This article quickly builds a complete...

The linkage method between menu and tab of vue+iview

Vue+iview menu and tab linkage I am currently dev...